public ActionResult priceFilter() { //ViewBag.prizerange = Request.Form["prizeRange"]; if (Request.Form["priceRangeFilterBtn"] != null) { int maximum = Convert.ToInt32(Request.Form["prizeRange"]); int categoryID = Convert.ToInt32(Request.Form["categoryID"]); // foodItems.GetByPrice(categoryID, 0, maximum) IEnumerable <Item_Category> categoryList = category.GetAllValues(); IEnumerable <restaurantItem> itemsList = foodItems.GetByPrice(categoryID, 0, maximum); IEnumerable <Item_Section> sectionList = section.GetByCategory(categoryID); List <ShowFoodItem> selectItemList = new List <ShowFoodItem>(); foreach (Item_Section sec in sectionList) { ShowFoodItem showItem = new ShowFoodItem(); showItem.sectionID = sec.Id; showItem.sectionName = sec.sectionName; selectItemList.Add(showItem); } foreach (restaurantItem i in itemsList) { ShowFoodItem showItem = new ShowFoodItem(); showItem.itemID = i.Id; showItem.itemName = i.itemName; showItem.itemPrice = i.itemPrice; showItem.itemPicture = i.itemPicture; showItem.restaurantID = restaurantInfo.GetSingle(i.restaurantID).Id; showItem.restaurantName = restaurantInfo.GetSingle(i.restaurantID).restaurantName; //showItem.restaurantRating = restaurantInfo.GetSingle(i.itemCategory).avarageRating; selectItemList.Add(showItem); } foreach (Item_Category c in categoryList) { ShowFoodItem cat = new ShowFoodItem(); cat.categoryID = c.Id; cat.categoryName = c.categoryName; selectItemList.Add(cat); } ViewBag.categoryID = categoryID; ViewBag.CategoryName = category.GetSingle(categoryID).categoryName; return(View(selectItemList)); } else { return(View("Index", "Home")); } }
public ActionResult Index(int Id) { IEnumerable <Item_Category> categoryList = category.GetAllValues(); IEnumerable <restaurantItem> itemsList = foodItems.GetByCategory(Id); IEnumerable <Item_Section> sectionList = section.GetByCategory(Id); List <ShowFoodItem> selectItemList = new List <ShowFoodItem>(); foreach (Item_Section sec in sectionList) { ShowFoodItem showItem = new ShowFoodItem(); showItem.sectionID = sec.Id; showItem.sectionName = sec.sectionName; selectItemList.Add(showItem); } foreach (restaurantItem i in itemsList) { ShowFoodItem showItem = new ShowFoodItem(); showItem.itemID = i.Id; showItem.itemName = i.itemName; showItem.itemPrice = i.itemPrice; showItem.itemPicture = i.itemPicture; showItem.itemSection = section.GetSingle(i.itemSection).sectionName; showItem.restaurantID = restaurantInfo.GetSingle(i.restaurantID).Id; showItem.restaurantName = restaurantInfo.GetSingle(i.restaurantID).restaurantName; //showItem.restaurantRating = restaurantInfo.GetSingle(i.itemCategory).avarageRating; selectItemList.Add(showItem); } foreach (Item_Category c in categoryList) { ShowFoodItem cat = new ShowFoodItem(); cat.categoryID = c.Id; cat.categoryName = c.categoryName; selectItemList.Add(cat); } ViewBag.categoryID = Id; ViewBag.CategoryName = category.GetSingle(Id).categoryName; return(View(selectItemList)); }
public ActionResult Index() { if (Request.Form["serachBtn"] != null) { string searchKeyword = Request.Form["nameSearch"]; IEnumerable <Restaurant_info> restInfoList = restaurant.searchRestaurants(searchKeyword); IEnumerable <restaurantItem> foodItemList = foodItem.searchItem(searchKeyword); List <ShowFoodItem> itemList = new List <ShowFoodItem>(); foreach (restaurantItem food in foodItemList) { ShowFoodItem item = new ShowFoodItem(); item.itemID = food.Id; item.itemName = food.itemName; item.restaurantID = food.restaurantID; item.restaurantName = restaurant.GetSingle(food.restaurantID).restaurantName; item.categoryID = food.itemCategory; item.categoryName = category.GetSingle(food.itemCategory).categoryName; item.sectionID = food.itemSection; item.sectionName = section.GetSingle(food.itemSection).sectionName; item.itemPicture = food.itemPicture; item.itemPrice = food.itemPrice; itemList.Add(item); } searchItemModel searchItem = new searchItemModel(); searchItem.foodItemFullDetailsList = itemList; searchItem.restInfoList = restInfoList; searchItem.categoryList = category.GetAllValues(); return(View(searchItem)); } else { return(View("Index", "Home")); } }