Exemplo n.º 1
0
        public CategoriesAndListCategories ListOfCategoriesViewModel()
        {
            CategoriesAndListCategories LOC = new CategoriesAndListCategories();

            LOC.ListOfCategories = dbContext.Categories.ToList();
            return(LOC);
        }
Exemplo n.º 2
0
        public IActionResult CreateCategory(CategoriesAndListCategories newCat)
        {
            if (ModelState.IsValid)
            {
                dbContext.Add(newCat.NewCategory);
                dbContext.SaveChanges();
                return(RedirectToAction("AllCategories")); //CHANGE LATER TO REDIRECT TO PRODUCT ID PAGE
            }
            CategoriesAndListCategories viewModel = ListOfCategoriesViewModel();

            return(View("Index", viewModel));
        }
Exemplo n.º 3
0
        public ViewResult AllCategories()
        {
            CategoriesAndListCategories viewModel = ListOfCategoriesViewModel();

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