Example #1
0
        public IActionResult Index(int?id)
        {
            IndexViewModel  vm  = new IndexViewModel();
            ShoppingManager mgr = new ShoppingManager(_connectionString);

            vm.Categories = mgr.GetAllCategories();
            vm.Products   = mgr.GetProductsForCategory(id);
            return(View(vm));
        }
Example #2
0
        public IActionResult ViewProduct(int id)
        {
            ShoppingManager      mgr = new ShoppingManager(_connectionString);
            ViewProductViewModel vm  = new ViewProductViewModel
            {
                Categories = mgr.GetAllCategories(),
                Product    = mgr.GetProduct(id)
            };

            return(View(vm));
        }
Example #3
0
        public IActionResult AddProduct()
        {
            ShoppingManager mgr = new ShoppingManager(_connectionString);

            return(View(mgr.GetAllCategories()));
        }