/// <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 Business.Order MapOrder(Entities.Orders order) { return(new Business.Order { Id = order.Id, LocationId = order.LocationId, CustomerId = order.CustomerId, Time = order.OrderDate, ProductOrders = order.ProductOrder.Select(MapProductOrder).ToList(), }); }
/// <summary> /// adds a new order and productOrders to the database /// </summary> /// <param name="order">order object to add to the database</param> public void AddOrder(Order order) { Entities.Orders newOrder = Mapper.MapOrder(order); _context.Add(newOrder); }