public ActionResult TourDetails(int id) { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User", new { ctl = "Admin", act = "AdminPanel" })); } Tour tour = new TourHandler().GetTourById(id); return(View(tour)); }
// GET: Tour public ActionResult TourManagment() { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User", new { ctl = "Home", act = "Index" })); } List <Tour> tours = new TourHandler().GetAllTours(); ViewBag.message = TempData["message"]; return(View(tours)); }
public ActionResult EditTour(int id) { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User", new { ctl = "Admin", act = "AdminPanel" })); } Tour tour = new TourHandler().GetTourById(id); ViewBag.companies = ModelHelper.ToSelectItemList(new CompanyHandler().GetAllCompanies()); return(View(tour)); }
// GET: Booking public ActionResult BookTrip(int id) { User user = (User)Session[WebUtil.CURRENT_USER]; if (user == null) { return(RedirectToAction("Login", "User")); } Tour tour = new TourHandler().GetTourById(id); ViewBag.HideSlider = true; return(View(tour)); }
public ActionResult TourDetail(int id) { Tour tour = new TourHandler().GetTourById(id); if (tour != null) { ViewBag.feedbacks = new FeedbackHandler().GetAllFeedbackByTourId(tour.Id); } else { ViewBag.feedbacks = null; } ViewBag.HideSlider = true; return(View(tour)); }
public ActionResult BookingConfirmed(int id) { User user = (User)Session[WebUtil.CURRENT_USER]; if (user == null) { return(RedirectToAction("Login", "User")); } Tour tour = new TourHandler().GetTourById(id); Booking booking = new Booking { Tour = tour, UserId = user.Id }; new BookingHandler().AddBooking(booking); ViewBag.HideSlider = true; return(View()); }
public ActionResult DeleteTourConfirmed(int id) { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User", new { ctl = "Admin", act = "AdminPanel" })); } try { Tour tour = new TourHandler().GetTourById(id); new TourHandler().DeleteTour(tour); return(RedirectToAction("TourManagment")); } catch { ViewBag.message = "Cannot Delete. This Tour Is Assigned To Some Booking. Delete That Booking First"; TempData["message"] = ViewBag.message; return(RedirectToAction("TourManagment")); } }