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)); }
public IActionResult ViewProduct(int id) { ShoppingManager mgr = new ShoppingManager(_connectionString); ViewProductViewModel vm = new ViewProductViewModel { Categories = mgr.GetAllCategories(), Product = mgr.GetProduct(id) }; return(View(vm)); }
public IActionResult AddProduct() { ShoppingManager mgr = new ShoppingManager(_connectionString); return(View(mgr.GetAllCategories())); }