public ActionResult Details(string category, int id, string format = null) { var repo = new ProductRepository(); var product = repo.Find(p => p.Id == id); if (product.Categories.Any(c => c.Name == category)) { if (format == "json") { return Json(product, JsonRequestBehavior.AllowGet); } return View(product); } return HttpNotFound(); }
public ActionResult ShowCategory(string category) { var repo = new ProductRepository(); return View(repo.GetByCategory(category)); }
public ActionResult Index() { var repo = new ProductRepository(); return View(repo.All()); }