public CustomerService.Customer UpdateDto( CustomerService.Customer dto, Model.Customer model) { if (dto.CustomerID != model.CustomerID) { dto.CustomerID = model.CustomerID; } if (dto.CompanyName != model.CompanyName) { dto.CompanyName = model.CompanyName; } if (dto.ContactName != model.ContactName) { dto.ContactName = model.ContactName; } if (dto.Address != model.Address) { dto.Address = model.Address; } if (dto.Region != model.Region) { dto.Region = model.Region; } if (dto.Country != model.Country) { dto.Country = model.Country; } if (dto.PostalCode != model.PostalCode) { dto.PostalCode = model.PostalCode; } return(dto); }
public static Model.Customer Update(this Model.Customer model, Service.Customer dto) { model.CustomerID = dto.CustomerID; model.CompanyName = dto.CompanyName; model.ContactName = dto.CompanyName; model.Address = dto.Address; model.Region = dto.Region; model.Country = dto.Region; model.PostalCode = dto.PostalCode; return(model); }
public Model.Customer UpdateModel(Model.Customer model, CustomerService. Customer dto) { if (model.CustomerID != dto.CustomerID) { model.CustomerID = dto.CustomerID; } if (model.CompanyName != dto.CompanyName) { model.CompanyName = dto.CompanyName; } if (model.ContactName != dto.ContactName) { model.ContactName = dto.ContactName; } if (model.Address != dto.Address) { model.Address = dto.Address; } if (model.City != dto.City) { model.City = dto.City; } if (model.Region != dto.Region) { model.Region = dto.Region; } if (model.Country != dto.Country) { model.Country = dto.Country; } if (model.PostalCode != dto.PostalCode) { model.PostalCode = dto.PostalCode; } if (model.Phone != dto.Phone) { model.Phone = dto.Phone; } if (dto.Orders != null) { model.Orders = GetOrdersFromDto(dto); } return(model); }
private static ObservableCollection <MVVM.Packpub.Northwind.Model.Order> GetOrdersFromDto(MVVM.Packpub.Northwind.Application.CustomerService.Customer dto) { IEnumerable <MVVM.Packpub.Northwind.Model.Order> orders = dto.Orders.Select(o => new Model.Order { OrderID = o.OrderID, OrderDate = o.OrderDate, OrderDetails = GetOrderDetailsFromDto(o), Freight = o.Freight, ShippedDate = o.ShippedDate }); return(new ObservableCollection <MVVM.Packpub.Northwind.Model.Order>(orders)); }
public Model.Customer CreateModel( CustomerService.Customer dto) { return(UpdateModel(new Model.Customer(), dto)); }