public ViewResult Index(int?id) { ViewBag.Categories = _catRepo.AllIncluding(category => category.Products); if (id == null || id == 0) { return(View(_prodRepo.AllIncluding(product => product.Categ))); } else { return(View(_prodRepo.All.Where(product => product.CategoryID == id))); } }
public ViewResult Index() { return(View(_catRepo.AllIncluding(cat => cat.Products))); }