public ActionResult Category(string category) { CategoryType cate = cat.GetCategoryByName(category); ViewBag.Title = cate.Title; ViewBag.SubTitle = cate.Description; if (category != null) { IEnumerable<Product> products = cat.GetProductsByCategoryId(cate.Id); CategoryViewModel vm = new CategoryViewModel { Category = cate, Products = products }; return View(vm); } ViewBag.Message = "Unfortunately we don't have a a category for " + category + "."; return View("Error"); }
//// //public ActionResult Index() //{ // HomeViewModel vm = new HomeViewModel(); // vm.Products = cat.GetProducts(); // return View(vm); //} public ActionResult Index(string CategoryName) { CategoryType category = cat.GetCategoryByName(CategoryName); if (category != null) { IEnumerable<Product> products = cat.GetProductsByCategoryId(category.Id); CategoryViewModel vm = new CategoryViewModel { Category = category, Products = products }; return View(vm); } ViewBag.Message = "Unfortunately we don't have a a category for " + CategoryName + "."; return View("Error"); }