예제 #1
0
        // GET: ComboMeal/Create
        public async Task <ActionResult> Create()
        {
            var comboProductViewModel = new ComboProductsViewModel()
            {
                ProductItems = _mapper.Map <List <ProductItemViewModel> >(await _productItemService.GetAllProductItemAsync())
            };

            return(View(comboProductViewModel));
        }
예제 #2
0
 // 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;
     }
 }
예제 #3
0
        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());
            }
        }