// // GET: /Category/Browse?Catgory=?Disco public ActionResult Browse(string category) { // Retrieve Category and its Associated SubCategories from database var categoryModel = shopDB.CategoryMasters.Include("SubcategoryMasters").Single(g => g.Name == category); var viewModel = new CategoryBrowseViewModel() { Category = categoryModel, SubCategories = categoryModel.SubCategoryMasters.ToList(), ReferenceSites = categoryModel.ReferenceSitesMasters.ToList(), Blogs = categoryModel.BlogMasters.ToList() }; return(View(viewModel)); }
public async Task <ActionResult> BrowseByID(int CategoryID) { CategoryModel category = await db.Categories.FindAsync(CategoryID); IList <ProductModel> allProucts = await db.GetCategoryProductsAsync(CategoryID); List <ProductModel> featuredProucts = new List <ProductModel>(); // TODO Randomize this maybe? for (int i = 0; i < 8 && i < allProucts.Count; i++) { featuredProucts.Add(allProucts[i]); } CategoryBrowseViewModel viewModel = new CategoryBrowseViewModel() { Category = category, FeaturedProducts = featuredProucts }; await this.FillViewBag(); return(View("Browse", viewModel)); }
public async Task <ActionResult> Browse(String Btn) { CategoryModel category = await(from c in db.Categories where c.CategoryName.ToLower() == Btn.ToLower() select c).SingleAsync(); IList <ProductModel> allProucts = await db.GetCategoryProductsAsync(category.CategoryID); List <ProductModel> featuredProucts = new List <ProductModel>(); // TODO Randomize this maybe? for (int i = 0; i < 8 && i < allProucts.Count; i++) { featuredProucts.Add(allProucts[i]); } CategoryBrowseViewModel viewModel = new CategoryBrowseViewModel() { Category = category, FeaturedProducts = featuredProucts }; await this.FillViewBag(); return(View(viewModel)); }