AyCode.Core/AyCode.Models/Users/AcUserModelDtoMinBase.cs

29 lines
954 B
C#

using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.Profiles.Dtos;
using AyCode.Interfaces.Users;
using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users;
public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfile, TProfileDto> : AcModelDtoBase
where TUserDtoMin : class, IAcUserDtoMinBase<TProfile>
where TProfile : class, IAcProfile
where TProfileDto : class, IAcProfileDtoBase
{
public TUserDtoMin UserDto { get; set;}
public TProfileDto? Profile { get; set; }
protected AcUserModelDtoMinBase() {}
protected AcUserModelDtoMinBase(IAcUserDtoMinBase<TProfile> user) : base(user.Id)
{
Id = user.Id;
UserDto = Activator.CreateInstance<TUserDtoMin>();
UserDto.Id = user.Id;
UserDto.AffiliateId = user.AffiliateId;
Profile = Activator.CreateInstance<TProfileDto>();
Profile.Id = user.Profile.Id;
Profile.Name = user.Profile.Name;
}
}