public static YourStore.Library.Customer MapCustomer(Entities.Customers c) { YourStore.Library.Order ord = new YourStore.Library.Order(); return(new YourStore.Library.Customer { FirstName = c.FirstName, LastName = c.LastName, Zip = c.Zip, Id = c.Id, Username = c.UserName, Pass = c.Pass, }); }
public static YourStore.Library.Order MapOrder(Entities.Orders or) { YourStore.Library.Order o = new YourStore.Library.Order(); o.Id = or.Id; o.Customer = MapCustomer(or.Customer); o.Store = MapStore(or.Store); o.Timer = (DateTime)or.DateTimeOrder; o.TotalCost = 0; foreach (Entities.OrderDetails od in or.OrderDetails) { o.Product.Add(MapProduct(od.Product), od.Quantity); o.TotalCost += (od.Product.Cost * od.Quantity); } return(o); }
public static Entities.Orders MapOrder(YourStore.Library.Order or) { Entities.Orders o = new Entities.Orders(); if (or.CustomersID == 0) { o.CustomerId = or.Customer.Id; } else { o.CustomerId = or.CustomersID; } if (or.StoreID == 0) { o.StoreId = or.Store.StoreID; } else { o.StoreId = or.StoreID; } o.DateTimeOrder = or.Timer; return(o); }