public ActionResult Sort(string sort) { var bl = new Dubuche.BL.RestaurantCRUD(); var list = Dubuche.BL.RestaurantCRUD.Casting(bl.GetAllRestaurants()); var sortedList = list; //var sortedList = RestaurantSort.AlphaSorting(Dubuche.BL.RestaurantCRUD.Casting(list)); //var downSortedList = RestaurantSort.BetaSorting(Dubuche.BL.RestaurantCRUD.Casting(list)); //var ratedSortedList = RestaurantSort.AvgRatingSort(Dubuche.BL.RestaurantCRUD.Casting(list)); //var topThreeSorted = RestaurantSort.AvgRatingSort(Dubuche.BL.RestaurantCRUD.Casting(list)); try { if (sort == "byName") { sortedList = RestaurantSort.AlphaSorting(list); } else if (sort == "byRating") { sortedList = RestaurantSort.AvgRatingSort(list); } else if (sort == "topThree") { sortedList = RestaurantSort.AvgRatingSort(list.Take(3).ToList()); } return(View(sortedList)); } catch { log = LogManager.GetLogger("mistakes"); return(RedirectToAction("Index")); } }
// GET: Restaurant/Details/5 public ActionResult Details(int id) { var bl = new Dubuche.BL.RestaurantCRUD(); var x = bl.GetRestaurantById(id); return(View(x)); }
// GET: Restaurant/Delete/5 public ActionResult Delete(int id) { var bl = new Dubuche.BL.RestaurantCRUD(); //bl.DeleteRestaurantById(id); return(View(bl.GetRestaurantById(id))); }
// GET: Reviewer/Create public ActionResult Create() { var bl = new Dubuche.BL.ReviewerCRUD(); var restCrud = new Dubuche.BL.RestaurantCRUD(); ViewBag.Rests = restCrud.GetAllRestaurants(); return(View()); }
// GET: Reviewer/Edit/5 public ActionResult Edit(int id) { var bl = new Dubuche.BL.ReviewerCRUD(); var x = bl.DisplayRestaurantReviewersById(id); var restCrud = new Dubuche.BL.RestaurantCRUD(); ViewBag.Rests = restCrud.GetAllRestaurants(); return(View(x)); }
//Search public ActionResult Search(string Name) { var bl = new Dubuche.BL.RestaurantCRUD(); List <Restaurant> newRestList = new List <Restaurant>(); newRestList = bl.GetAllRestaurants(); return(View(RestaurantSearch.Lookup(newRestList, Name))); }
// GET: Restaurant public ActionResult Index() { var bl = new Dubuche.BL.RestaurantCRUD(); //var list = bl.GetAllRestaurants(); return(View(bl.GetAllRestaurants())); //List<Restaurant> A }
public ActionResult Edit(int id, Restaurant restaurant2) { try { // TODO: Add update logic here var bl = new Dubuche.BL.RestaurantCRUD(); bl.UpdateRestaurant(restaurant2); return(RedirectToAction("Index")); } catch { log = LogManager.GetLogger("mistakes"); return(View()); } }
public ActionResult Create(Restaurant restaurant) { try { // TODO: Add insert logic here var bl = new Dubuche.BL.RestaurantCRUD(); bl.CreateRestaurant(restaurant); return(RedirectToAction("Index")); } catch { log = LogManager.GetLogger("mistakes"); return(View()); } }
public ActionResult Delete(int id, Restaurant restaurant) { try { // TODO: Add delete logic here var bl = new Dubuche.BL.RestaurantCRUD(); bl.DeleteRestaurantById(id); return(RedirectToAction("Index")); } catch (Exception e) { log = LogManager.GetLogger("mistakes"); log.Error($"[Restaurants Controller] [Details] Exception thrown: {e.Message}"); return(RedirectToAction("Index")); } }