// GET: ComboMeal/Create public async Task <ActionResult> Create() { var comboProductViewModel = new ComboProductsViewModel() { ProductItems = _mapper.Map <List <ProductItemViewModel> >(await _productItemService.GetAllProductItemAsync()) }; return(View(comboProductViewModel)); }
// GET: ProductItem public async Task <ActionResult> Index() { try { ViewBag.Message = TempData["Message"]; var productItems = _mapper.Map <List <ProductItemViewModel> >(await _productItemService.GetAllProductItemAsync()); return(View(productItems)); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Index() { try { var productItems = _mapper.Map <List <ProductItemViewModel> >(await _productItemService.GetAllProductItemAsync()); var products = productItems.Select(x => new SelectProductViewModel() { Id = x.Id, Name = x.Name, Price = x.Price, ProductCategory = x.Product.Name, Quantity = 1 }).ToList(); return(View(products)); } catch (Exception) { return(View()); } }