public async Task <IActionResult> AddProductInstance(int productId) { var sessionLunch = _cartRepository.GetOrCreateSessionLunch(); var result = await _lunchRepository.AddItemInstanceAsync(sessionLunch.Lunch.LunchId, productId); var route = "~/Views/Lunch/ItemDetail.cshtml"; return(PartialView(route, result)); }
public async Task <_Catering> AddItem(int id) { var catering = _cart.SessionCatering(); if (catering != null && catering.Items != null && catering.Items.FirstOrDefault(i => i.Item != null && i.Item.ProductId == id) != null) { await _catering.AddItemInstanceAsync(catering.LunchId, id); } else { await _catering.AddItemAsync(catering.LunchId, id); } catering = _cart.SessionCatering(); return(catering); }