public static Customer ToCustomer(this DomainModels.Customer domain) { return(new Customer { Id = domain.Id, Name = domain.Name, Surname = domain.Surname, Address = domain.Address, Age = domain.Age, Created = domain.Created }); }
public static Customer ToCustomer(this DomainModels.Customer domain) { var purchases = domain.CarPurchases? .Select(o => o.ToCarPurchase()) .ToList() ?? new List <CarPurchase>(); return(new Customer { Id = domain.Id, Address = domain.Address, CarPurchases = purchases, Age = domain.Age, Created = domain.Created, Name = domain.Name, Surname = domain.Surname }); }