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

34 lines
1.2 KiB
C#

using AyCode.Interfaces.Addresses;
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, TProfileAddress> : AcModelDtoBase, IAcUserModelDtoMinBase
where TUserDtoMin : class, IAcUserDtoMinBase<TProfile>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileDto : class, IAcProfileDtoBase
where TProfileAddress : class, IAcAddress
{
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;
Profile.FirstName = user.Profile.FirstName;
Profile.LastName = user.Profile.LastName;
//Profile.NickName = user.Profile.NickName;
}
}