// BusinessLayer.ShoppingCart sc = new BusinessLayer.ShoppingCart(); // [OutputCache(Duration = 600)] public ActionResult Index() { //Get Guest as login detail BusinessLayer.ShoppingCart sc = new BusinessLayer.ShoppingCart(); //sc.AddGuestBrowserTotblUserProfile(); /* var genres = new List<FoodGroup> * { * new FoodGroup{FoodGroupName = "Cereal and Grains"}, * new FoodGroup{FoodGroupName = "Fats and Oils"}, * new FoodGroup{FoodGroupName = "Vegetable"}, * new FoodGroup{FoodGroupName = "Diary"}, * new FoodGroup{FoodGroupName = "Proteins"}, * };*/ //var genres = storeDB.FoodGroups.ToList(); var genres = storeDB.FoodGroups.OrderBy(a => a.FoodGroupName).ToList(); return(View(genres)); }
// // GET: /Store/AddToCart/5 //[ChildActionOnly] public ActionResult AddToCart(decimal id) //public ActionResult AddToCart(BusinessLayer.FoodItem id) { // Retrieve the album from the database /*BusinessLayer.FoodItem addedAlbum = storeDB.FoodItems * .Single(album => album.FoodItemId == id);*/ BusinessLayer.FoodItem fooditem = dbset.FoodItems.Single(emp => emp.FoodItemId == id); //Get SubgroupID decimal subgrpId = fooditem.FoodGroupId; // Add it to the shopping cart BusinessLayer.ShoppingCart cart = BusinessLayer.ShoppingCart.GetCart(this.HttpContext); cart.AddToCart(fooditem); //cart.AddToCart(id); // Go back to the main store page for more shopping //return RedirectToAction("Index", "Home"); return(RedirectToAction("Browse", "Store", new { id = subgrpId })); }