public PrepareOrderMessage(String customerName, String drink, DrinkSize size, Guid orderId) { CustomerName = customerName; Drink = drink; DrinkSize = size; OrderId = orderId; }
public OrderPlaced(String customerName, String drink, DrinkSize size, Guid orderId) { CustomerName = customerName; Drink = drink; DrinkSize = size; OrderId = orderId; }
public CustomerRefusesToPayView(String customerName, Decimal amount, String drink, DrinkSize drinkSize) { CustomerName = customerName; Amount = amount; Drink = drink; DrinkSize = drinkSize.ToString(); }
public NewOrderMessage(String customerName, String drink, DrinkSize drinkSize) { CustomerName = customerName; Drink = drink; DrinkSize = drinkSize; OrderId = Guid.NewGuid(); }
public Menu(DishType DishType, DrinkSize DrinkSize, DessertType DessertType = DessertType.Normal, bool HasCoffee = false) { this.DishType = DishType; this.DrinkSize = DrinkSize; this.DessertType = DessertType; this.HasCoffee = HasCoffee; }
public void UpdateDrinkSize(DrinkSize drinkSize) { var oDrinkSize = _appDbContext.DrinkSizes.FirstOrDefault(ds => ds.Id == drinkSize.Id); if (oDrinkSize == null) { _appDbContext.DrinkSizes.Add(drinkSize); } else { _appDbContext.Entry(oDrinkSize).State = EntityState.Detached; _appDbContext.Entry(drinkSize).State = EntityState.Modified; _appDbContext.Update(drinkSize); }; if (drinkSize.IsPrimary) { var sizes = _appDbContext.DrinkSizes.Where(s => s.Id != drinkSize.Id && s.DrinkId == drinkSize.DrinkId); foreach (var s in sizes) { s.IsPrimary = false; } } _appDbContext.SaveChanges(); }
public static AvailableSize From(DrinkSize drinkSize) => new AvailableSize { Id = drinkSize.Id.Value, Volume = drinkSize.Volume.Value, Name = drinkSize.Name.Value, Price = drinkSize.Price.Amount };
public void StartCoffee(DrinkSize size, bool iced) { _coffeeDrink = new CoffeeDrink { Size = size, Iced = iced }; }
public Menu(string foodName, double price, bool isAvailable, DrinkSize sizeOfDrink) { FoodName = foodName; Price = price; IsAvailable = isAvailable; SizeOfDrink = sizeOfDrink; }
public static Drink GetDrinkFromMenu(decimal dbId, DrinkSize drinkSize) { var drinkKey = Tuple.Create <decimal, DrinkSize>(dbId, drinkSize); if (DbIdDrinkDictionary.ContainsKey(drinkKey)) { return(DbIdDrinkDictionary[drinkKey]); } //TODO: Display error if drink is not in dictionary! return(new Drink()); }
public virtual void SetDrinkSize(DrinkSize drinkSize) // seteaza masura { try { this.size = drinkSize; } catch (MyCustomException exception) { throw new MyCustomException("Couldnt set drink size!"); } }
public static Drink MakeDrink(DrinkType type, DrinkFlavor flavor, DrinkSize size) { var delay = (flavor.GetHashCode() + size.GetHashCode() + (type.GetHashCode() * 2)) * 300; Thread.Sleep(delay); return(new Drink { Id = Guid.NewGuid(), Flavor = flavor, Size = size, Type = type }); }
public async Task <IActionResult> UpdateDrinkSize(DrinkSize drinkSize) { try { _drinkRepository.UpdateDrinkSize(drinkSize); } catch (DbUpdateConcurrencyException) { return(Json(new { success = false })); } var drink = _drinkRepository.GetDrinkById(drinkSize.DrinkId); var table = await this.RenderViewAsync("_ListDrinkSize", drink.DrinkSizes, true); return(Json(new { success = true, html = table })); }
private static Decimal CalculateAmountAccordingTo(DrinkSize size) { switch (size) { case DrinkSize.Tall: return(3.25m); case DrinkSize.Grande: return(4.00m); case DrinkSize.Venti: return(4.75m); default: throw new InvalidOperationException(String.Format("Size '{0}' does not compute!", size)); } }
public void DrinkSizeGetPriceBySize() { double price1 = 3.0; double price2 = 5.0; double price3 = 7.50; DrinkSize drink = new DrinkSize { Small = 3.0, Large = 5.0, Ultra = 7.50, }; Assert.Equal(price1, drink.getPriceBySize("small")); Assert.Equal(price2, drink.getPriceBySize("large")); Assert.Equal(price3, drink.getPriceBySize("ultra")); }
public IActionResult UpdateDrinkSize(int?id, int drinkId) { var size = new DrinkSize(); if (id == null) { size.DrinkId = drinkId; size.IsActive = true; } else { size = _drinkRepository.GetSizeById(id.Value); if (size == null) { return(NotFound()); } } ViewBag.Units = _drinkRepository.DrinkUnits; return(PartialView(size)); }
public static Drink GetDrink(GuestItem oldGuestItem) { DrinkSize drinkSize = DrinkSize.JustOneSize; switch (oldGuestItem.SelectSizeID) { case 3: drinkSize = DrinkSize.Glass; break; case 6: drinkSize = DrinkSize.Bottle; break; case 1: drinkSize = DrinkSize.Pint; break; case 2: drinkSize = DrinkSize.Pitcher; break; default: drinkSize = DrinkSize.JustOneSize; break; } Drink drink = MenuDrinks.GetDrinkFromMenu(oldGuestItem.ID, drinkSize); var newdrink = drink.GetClone(); newdrink.DbItemId = oldGuestItem.ID; newdrink.WasSentToKitchen = oldGuestItem.OrderSent; newdrink.DbOrderId = (int)oldGuestItem.OrderID; newdrink.ItemCount = 1; return(newdrink); }
private DrinkSizeDetails ToLastDrinkSizeDetails(DrinkSize size) { return(DrinkSizeDetails.Ordered(size.Id, size.Volume, size.Name)); }
public ReceivedFullPaymentView(String customerName, String drink, DrinkSize drinkSize) { CustomerName = customerName; Drink = drink; DrinkSize = drinkSize.ToString(); }
public Drink(string name, DrinkSize size) { Name = name; Size = size; }
public Drink(string name, DrinkType type, DrinkSize drinkSize, bool hasStandardSize) : this(name, type) // aici mostenim din base name si type si adaugam the rest { this.size = size; this.hasStandardSize = hasStandardSize; }
public CustomerRefusesToPayView(String customerName, Double amount, String drink, DrinkSize drinkSize) { CustomerName = customerName; Amount = amount; Drink = drink; DrinkSize = drinkSize.ToString(); }
public DeliverOrderView(String drink, DrinkSize size) { Drink = drink; DrinkSize = size.ToString(); }
public OrderIsTrashedView(string drink, string customerName, DrinkSize size) { this.drink = drink; this.customerName = customerName; this.size = size; }
public PrepareOrderView(String customerName, String drink, DrinkSize size) { CustomerName = customerName; Drink = drink; DrinkSize = size.ToString(); }
static public void AddOrder //adding order object both to stack and to queue (Queue <Order> ordersQueue, Stack <Order> ordersStack, Student orderer, CoffeeDrinks drink, DrinkSize cupsize) { Order order = new Order { Orderer = orderer, Drink = drink, Size = cupsize }; Console.WriteLine($"{order.Orderer.FirstName} {order.Orderer.LastName} ordered a {order.Size} cup of {order.Drink}"); ordersQueue.Enqueue(order); ordersStack.Push(order); }
private OrderItem(Drink drink, DrinkSize drinkSize, Quantity count) => (Drink, Size, Count) = (drink, drinkSize, count);
public Drink(String name, DrinkSize drinkSize) { this.name = name; this.size = drinkSize; }
private OrderItem(Drink drink, DrinkSize drinkSize) => (Drink, Size) = (drink, drinkSize);
public Coffee(DrinkSize drinksize, decimal crustPrice, params Content[] contents) { DrinkSize = drinksize; Contents = contents; Price = crustPrice + contents.Sum(x => x.Price * x.Size); }
public DrinkOrder(bool iced, DrinkSize drinkSize, CoffeeBuilder drink) { Iced = iced; DrinkSize = drinkSize; Drink = drink; }