public IActionResult AddFood() { var food = new FoodSelectionModel(); food.Food = breakfastList.Concat(lunchList).Concat(dinnerList).ToList(); ViewBag.Title = "Suggestions"; return(View(food)); }
public IActionResult AddFoodAmount(FoodSelectionModel model) { var foodList = breakfastList.Concat(lunchList).Concat(dinnerList).ToList(); var food = foodList.Where(m => m.Id == model.SelectedFood).FirstOrDefault(); var name = HttpContext.Session.GetString("Name"); ViewBag.Name = name.Substring(0, name.IndexOf(" ")); return(View(food)); }
public IActionResult SearchFood(string searchString) { var foodModel = new FoodSelectionModel(); var food = breakfastList.Concat(lunchList).Concat(dinnerList).ToList(); foodModel.Food = food; if (!string.IsNullOrEmpty(searchString)) { foodModel.Food = food.Where(m => m.Name.ToLower().Contains(searchString.ToLower())).ToList(); } ViewBag.Title = "Search Results"; return(View("AddFood", foodModel)); }