// GET: Restaurant public ActionResult Index(string SearchString, string sort) { ViewBag.Search = SearchString; //IEnumerable<Restaurant> rest; if (!String.IsNullOrEmpty(SearchString)) { View(da.SearchByPartialName(SearchString)); } else { View(da.ShowRestaurants()); } ViewBag.NameSortParm = sort == "name_asc" ? "name_desc" : "name_asc"; ViewBag.TopRatingSortParm = sort == "rating_top" ? "rating_worst" : "rating_top"; ViewBag.Top3RatingSortParm = sort == "rating_top3" ? "default" : "rating_top3"; switch (sort) { case "name_desc": View(Sort1.SortDescending((List <Restaurant>)(da.ShowRestaurants()))); break; case "name_asc": View(Sort1.SortAscending((List <Restaurant>)(da.ShowRestaurants()))); break; case "rating_top": View(Sort1.SortTopRating((List <Restaurant>)(da.ShowRestaurants()))); break; case "rating_worst": View(Sort1.SortWorstRating((List <Restaurant>)(da.ShowRestaurants()))); break; case "rating_top3": View(Sort1.SortTop3Rating((List <Restaurant>)(da.ShowRestaurants()))); break; default: break; } return(View()); }