public override double GetCost() { var size = _beverage.GetSize(); switch (size) { case CupSize.Small: return(_beverage.GetCost() + 0.10); case CupSize.Middle: return(_beverage.GetCost() + 0.15); case CupSize.Big: return(_beverage.GetCost() + 0.20); } throw new ArgumentException(nameof(CupSize)); }
public override float GetCost() { if (Beverage != null) { return(base.GetCost() + Beverage.GetCost()); } else { throw null; } }
public OrderItem AddOrderItem(OrderItem item) { Beverage beverage = _ctx.Beverages .Include(b => b.BeverageSales) .ThenInclude(b => b.Sale) .Where(b => b.Id == item.BeverageId) .FirstOrDefault(); item.Description = beverage.GetDescription(); item.UnitPrice = beverage.GetCost(); _ctx.OrderItems.Add(item); _ctx.SaveChanges(); return(item); }
public Order CreateOrder(Order order) { foreach (OrderItem item in order.Items) { Beverage beverage = _ctx.Beverages .Include(b => b.BeverageSales) .ThenInclude(b => b.Sale) .Where(b => b.Id == item.BeverageId) .FirstOrDefault(); item.Description = beverage.GetDescription(); item.UnitPrice = beverage.GetCost(); } _ctx.Orders.Add(order); _ctx.SaveChanges(); return(order); }
public override double GetCost() { double cost = _beverage.GetCost(); switch (_beverage.Size) { case BeverageSize.Tall: cost += 0.10; break; case BeverageSize.Grand: cost += 0.15; break; case BeverageSize.Venti: cost += 0.20; break; } return(cost); }
public override decimal GetCost() { return(_beverage.GetCost() + 0.75m); }
public override float GetCost() { return(beverage.GetCost() + cost); }
public override double GetCost() { return(_beverage.GetCost() + 0.20); }
public override double GetCost() { return(.15 + beverage.GetCost()); }