/// <summary> /// Turn a map order with their orderlines into a model order with model orderlines /// </summary> /// <param name="order"></param> /// <returns></returns> public static Domain.Models.Order MapOrderWithOrderLinesAndLocation(Entities.OrderEntity order) { return(new Domain.Models.Order { OrderNumber = order.Id, Purchase = order.Orderlines.Select(MapperOrderLine.Map).ToList(), TimeStamp = (DateTime)order.OrderDate, LocationPlaced = MapperLocation.Map(order.Location) }); }
/// <summary> /// This turns a customer Entity into a customer model. /// </summary> /// <param name="customer">The customer entity.</param> /// <returns></returns> public static Domain.Models.Customer Map(Entities.CustomerEntity customer) { return(new Domain.Models.Customer { ID = customer.Id, FirstName = customer.FirstName, LastName = customer.LastName, MyStoreLocation = MapperLocation.Map(customer.Location) }); }
/// <summary> /// Turn a model customer with their location into a entity customer /// </summary> /// <param name="customer"></param> /// <returns></returns> public static Entities.CustomerEntity MapCustomerWithLocation(Domain.Models.Customer customer) { return(new Entities.CustomerEntity { FirstName = customer.FirstName, LastName = customer.LastName, Id = customer.ID, Location = MapperLocation.Map(customer.MyStoreLocation) }); }
/// <summary> /// Turn an entity customer with their orders into a customer model /// </summary> /// <param name="customer"></param> /// <returns></returns> public static Domain.Models.Customer MapCustomerWithOrders(Entities.CustomerEntity customer) { return(new Domain.Models.Customer { FirstName = customer.FirstName, LastName = customer.LastName, ID = customer.Id, MyStoreLocation = MapperLocation.Map(customer.Location), Orders = customer.Orders.Select(MapperOrder.MapOrderWithOrderLines) }); }
/// <summary> /// Turn an entity customer with their location into a model customer /// </summary> /// <param name="customer"></param> /// <returns></returns> public static Domain.Models.Customer MapCustomerWithLocation(Entities.CustomerEntity customer) { return(new Domain.Models.Customer { FirstName = customer.FirstName, LastName = customer.LastName, ID = customer.Id, MyStoreLocation = MapperLocation.MapLocationsWithInventory(customer.Location), MyCart = customer.Shoppingcarts.Select(sc => new Domain.Models.ShoppingCart { DateCreated = (System.DateTime)sc.CreateData, ID = sc.CartId, CartItems = sc.Cartitems.Select(ci => new Domain.Models.CartItem { ID = ci.ItemId, Book = Domain.Models.Book.GetBookFromLibrary(ci.BookIsbn), Quantity = ci.Quantity }) }).FirstOrDefault() }); }