示例#1
0
        private void GetViewData(FirstStepReservationModel model)
        {
            var now = new AllFlightsForReservationsViewModel();

            ProccessGoingFlights(model, now);
            //TODO
            if (ModelClass.OneWay == false)
            {
                ProccessReturning(model, now);
            }


            this.ViewData["AllFlightInfo"] = now;
        }
示例#2
0
        private void ProccessReturning(FirstStepReservationModel model, AllFlightsForReservationsViewModel now)
        {
            now.PagerOnReturning ??= new PagerViewModel();
            now.PagerOnReturning.CurrentPage = now.PagerOnReturning.CurrentPage <= 0 ? 1 : now.PagerOnReturning.CurrentPage;

            List <FlightViewModel> items = context.Flights.Skip((now.PagerOnReturning.CurrentPage - 1) * PageSize).Take(PageSize).Select(c => new FlightViewModel()
            {
                Id        = c.Id,
                From      = c.From,
                To        = c.To,
                Departure = c.Departure,
                Arrival   = c.Arrival
            }).Where(c => c.From == model.To && c.To == model.From && c.Departure >= model.DepartureDate).ToList();

            now.ReturningFlights            = items;
            now.PagerOnReturning.PagesCount = (int)Math.Ceiling(context.Flights.Count() / (double)PageSize);
        }