コード例 #1
0
        public async Task <IActionResult> ManageProducts()
        {
            ManageProductsViewModel model = new ManageProductsViewModel();

            model.Products = await productRepo.GetAllProductWithCategory();

            return(View(model));
        }
コード例 #2
0
        public IActionResult Products()
        {
            //var products = _productsRepository.Get().ToList();
            var manageProductsVM = new ManageProductsViewModel()
            {
                ProductsList = _productsRepository.Get().ToList(),
                ProductData  = new Product()
            };

            return(View(manageProductsVM));
        }
コード例 #3
0
        public IActionResult ManageProducts(ProductFilterInputModel input)
        {
            var model = new ManageProductsViewModel()
            {
                Page       = input.Page,
                Products   = this.productService.GetAllProducts <ProductsViewModel>(input),
                PagesCount = (int)Math.Ceiling(this.productService.GetAllProductsCount(input) / (double)GlobalConstants.PageSize),
                Filters    = input,
            };

            return(this.View(model));
        }
コード例 #4
0
        public ActionResult AddProducts(ManageProductsViewModel manageProductsViewModel)
        {
            if (manageProductsViewModel == null)
            {
                return(View("~/Views/Common/NotFound.cshtml", new NotFoundViewModel()
                {
                    ElementName = "Products"
                }));
            }

            if (ModelState.IsValid)
            {
                if (ModelState.Values.Any(x => x.Errors.Count >= 1))
                {
                    return(View("AddMany", manageProductsViewModel));
                }
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Please upload an Excel file with product information.");
                return(View("AddMany", manageProductsViewModel));
            }
            return(RedirectToAction("index"));
        }
コード例 #5
0
 /// <summary>
 /// Opens the Product Inventory View
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnProductInventory_Click(object sender, RoutedEventArgs e)
 {
     DataContext = new ManageProductsViewModel();
 }