29 lines
971 B
C#
29 lines
971 B
C#
using AyCode.Entities.Profiles;
|
|
using AyCode.Interfaces.Users.Dtos;
|
|
using AyCode.Models.Users;
|
|
using TIAM.Entities.Products;
|
|
using TIAM.Entities.Profiles;
|
|
using TIAM.Entities.Users;
|
|
using TIAM.Models.Dtos.Profiles;
|
|
|
|
namespace TIAM.Models.Dtos.Users;
|
|
|
|
public class UserModelDto : AcUserModelDtoBase<UserDto, Profile, ProfileDto>
|
|
{
|
|
public List<UserProductMapping> UserProductMappings = new();
|
|
public List<Product> Products = new();
|
|
|
|
public UserModelDto(){}
|
|
public UserModelDto(User user) : base(user)
|
|
{
|
|
foreach (var product in user.Products)
|
|
{
|
|
Products.Add(new Product(product.Id, product.ServiceProviderId, product.ProductType, product.Name, product.Description, product.Price, product.JsonDetails));
|
|
}
|
|
|
|
foreach (var userProduct in user.UserProductMappings)
|
|
{
|
|
UserProductMappings.Add(new UserProductMapping(userProduct.Id, userProduct.UserId, userProduct.ProductId));
|
|
}
|
|
}
|
|
} |