Exemple #1
0
 /// <summary>
 /// Method takes in DB orders and converts them to Business Logic orders and vice versa
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public BusinessLogic.Orders ParseOrders(Entities.Orders o)
 {
     return(new BusinessLogic.Orders()
     {
         Cust = ParseCustomer(_context.Customer.Single(c => c.CustId == o.CustId)),
         Location = ParseLocation(_context.Location.Single(l => l.LocationId == o.LocationId)),
         CustOrder = ParseCustOrder(_context.CustOrder.Where(c => c.OrderId == o.OrderId).ToList()),
         Date = o.OrderDate,
         Total = o.Total
     });
 }
 /// <summary>
 /// converts an order entity into an order object
 /// </summary>
 /// <param name="order">oder entity to be converted</param>
 /// <returns>order object</returns>
 public static Order MapOrder(Entities.Orders order)
 {
     return(new Order
     {
         Id = order.Id,
         LocationId = order.LocationId,
         CustomerId = order.CustomerId,
         Date = order.Date,
         ProductOrders = order.ProductOrdered.Select(MapProductOrder).ToList(),
     });
 }