예제 #1
0
 /// <summary>
 /// Get the total number of pizzas on the order
 /// </summary>
 /// <param name="order">The order being checked</param>
 /// <returns>Integer value of the total number of pizzas on the order</returns>
 public int GetNumberOfOrderItems(Orders order)
 {
     return(Db.OrderEntries.Where(m => m.OnOrder == order.OId).ToList().Sum(m => m.Quantity));
 }
예제 #2
0
 /// <summary>
 /// Get a list of the order entries of a given order
 /// </summary>
 /// <param name="order">The order to return the details of</param>
 /// <returns>The list of order entries for the order</returns>
 public IList <OrderEntries> ShowOrderDetails(Orders order) => Db.OrderEntries.AsNoTracking().Include(m => m.PizzaNavigation).Where(m => m.OnOrder == order.OId).ToList();
예제 #3
0
 /// <summary>
 /// Get the total price of a given order
 /// </summary>
 /// <param name="order">The order to get the total for</param>
 /// <returns>A decimal value of the total price</returns>
 public decimal GetOrderTotal(Orders order)
 {
     return(Db.OrderEntries.Include(m => m.PizzaNavigation).Where(m => m.OnOrder == order.OId).ToList().Sum(m => (m.PizzaNavigation.Price * m.Quantity)));
 }