示例#1
0
        public ActionResult ReceiveNewProduct(Product newProduct)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "hihi");

                GetSuppliersListItem(newProduct);
                GetCategoriesListItem(newProduct);

                return(View(nameof(CreateProduct), newProduct));
            }

            _productsRepo.InsertNewProduct(newProduct);
            TempData["IsCreateProductSuccessful"] = true;
            return(Redirect("CreateProduct"));
        }