public IActionResult DispenseSoda(VendingSession session) { session.DispenseSoda(session.SelectedSodaId, sodas); if (session.VendingState == VendingStates.Sold) { foreach (var promotion in promotions) { if (promotion.IsActive) { promotion.PlayPromotion(); } } AddTransaction(session.SelectedSodaId); } var indexViewModel = new IndexViewModel { Promotions = promotions, Sodas = sodas, VendingSession = session }; return(View("Index", indexViewModel)); }
public IActionResult DispenseSoda(VendingSession session) { session.DispenseSoda(session.SelectedSodaId, _sodas); var indexViewModel = new IndexViewModel { Sodas = _sodas, VendingSession = session }; return(View("Index", indexViewModel)); }