public ActionResult Index() { TourRepository tourRepository = new TourRepository(); List<Tour> tours = tourRepository.GetAll().Where(tour => tour.StartDate >= DateTime.Now).Where(x => x.Orders.Count() < x.PlaceCount).ToList(); return View(tours); }
public ActionResult OrderTour(int id) { TourRepository tourRepository = new TourRepository(); List<Tour> tours = tourRepository.GetAll().Where(t => t.StartDate >= DateTime.Now).Where(x => x.Orders.Count() < x.PlaceCount).ToList(); ViewBag.Tours = new SelectList(tours, "Id", "Name", id); var tour = tours.First(x => x.Id == id); var number = Enumerable.Range(1, tour.PlaceCount - tour.Orders.Sum(x => x.PlaceCount)); ViewBag.Number = new SelectList(number); return View(); }
public ActionResult AllTours() { var tourRepository = new TourRepository(); List<Tour> model = tourRepository.GetAll().ToList(); return View(model); }
public ActionResult Orders() { TourRepository tourRepository = new TourRepository(); List<Tour> tours = tourRepository.GetAll().ToList(); return View(tours); }