Пример #1
0
        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);
        }
Пример #2
0
        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();
        }
Пример #3
0
 public ActionResult AllTours()
 {
     var tourRepository = new TourRepository();
     List<Tour> model = tourRepository.GetAll().ToList();
     return View(model);
 }
Пример #4
0
        public ActionResult Orders()
        {
            TourRepository tourRepository = new TourRepository();
            List<Tour> tours = tourRepository.GetAll().ToList();

            return View(tours);
        }