public async Task <_Catering> SaveLocalCatering([FromBody] IEnumerable <_CateringItem> catItems) { _cart.ClearCustomCateringFromCart(); var catering = _cart.SessionCatering(); foreach (var catItem in catItems) { await _catering.AddItemAsync(catering.LunchId, catItem.Item.ProductId, catItem.Quantity); } return(_cart.SessionCatering()); }
public async Task <IActionResult> AddProduct(int productId) { var sessionLunch = _cartRepository.GetOrCreateSessionLunch(); var result = await _lunchRepository.AddItemAsync(sessionLunch.Lunch.LunchId, productId); var route = "~/Views/Lunch/ItemDetail.cshtml"; return(PartialView(route, result)); }