Esempio n. 1
0
        public ProductsAndListProducts ListOfProductsViewModel()
        {
            ProductsAndListProducts LOP = new ProductsAndListProducts();

            LOP.ListOfProducts = dbContext.Products.ToList();
            return(LOP);
        }
Esempio n. 2
0
        public IActionResult CreateProduct(ProductsAndListProducts newPro)
        {
            if (ModelState.IsValid)
            {
                dbContext.Add(newPro.NewProduct);
                dbContext.SaveChanges();
                return(RedirectToAction("Index")); //CHANGE LATER TO REDIRECT TO PRODUCT ID PAGE
            }
            ProductsAndListProducts viewModel = ListOfProductsViewModel();

            return(View("Index", viewModel));
        }
Esempio n. 3
0
        public ViewResult Index()
        {
            ProductsAndListProducts viewModel = ListOfProductsViewModel();

            return(View("Index", viewModel));
        }