AyCode.Core/AyCode.Models/Users/AcUserModelDtoBase.cs

26 lines
832 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 AcUserModelDtoBase<TUserDto, TProfile, TProfileDto> : AcUserModelDtoMinBase<TUserDto, TProfile>
where TUserDto : class, IAcUserDtoBase
where TProfile : class, IAcProfileBase
where TProfileDto : class, IAcProfileDtoBase
{
public TProfileDto Profile { get; set; }
protected AcUserModelDtoBase() {}
protected AcUserModelDtoBase(IUserBase<TProfile> user, TProfile? profile) : base(user)
{
if (profile == null) return;
Profile = Activator.CreateInstance<TProfileDto>();
Profile.Id = profile.Id;
Profile.Name = profile.Name;
Profile.OwnerId = profile.OwnerId;
}
}