using AyCode.Models.Users; using TIAM.Entities.Products; using TIAM.Entities.Profiles; using TIAM.Entities.ServiceProviders; using TIAM.Entities.Users; namespace TIAM.Models.Dtos.Users; public class UserModelDto : AcUserModelDtoBase, IProductsRelation, IUserModelDtoMinBase { public List UserProductMappings { get; set; } public List Products { get; set; } public UserModelDto(){} public UserModelDto(User user) : base(user) { if (user.Products.Count == 0) return; //így proxy error lesz... - J. //Products = new List(user.Products); //UserProductMappings = new List(user.UserProductMappings); Products = new List(user.Products.Count); UserProductMappings = new List(user.UserProductMappings.Count); 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)); } } }