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

29 lines
941 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
where TProfile : class, IAcProfileBase
where TProfileDto : class, IAcProfileDtoBase
{
public TUserDtoMin UserDto { get; set;}
public TProfileDto? Profile { get; set; }
protected AcUserModelDtoMinBase() {}
protected AcUserModelDtoMinBase(IUserBase<TProfile> user) : base(user.Id)
{
Id = user.Id;
UserDto = Activator.CreateInstance<TUserDtoMin>();
UserDto.Id = user.Id;
Profile = Activator.CreateInstance<TProfileDto>();
Profile.Id = user.Profile.Id;
Profile.Name = user.Profile.Name;
Profile.OwnerId = user.Profile.OwnerId;
}
}