コード例 #1
0
        public IActionResult ViewScheduleDetails(string id)
        {
            var sched = _scheduleCollection.GetById(id);
            ScheduleDetailsViewModel model = new ScheduleDetailsViewModel()
            {
                Name   = sched.Name,
                Shifts = sched.Shifts
            };

            return(View(model));
        }
コード例 #2
0
        public ActionResult ScheduleDetails(int scheduleId)
        {
            var schedule = _scheduleRepo.GetSchedule(scheduleId);
            var model    = new ScheduleDetailsViewModel
            {
                Schedule  = schedule,
                FreeTimes = _scheduleService.GetFreeTimes(schedule)
                            .ToDictionary(t => t.Id, t => $"{_scheduleService.FormatTime(t.Time)}"),
                ReservedTimes = _scheduleService.GetReservedTimes(schedule)
                                .ToDictionary(t => t.Id, t => $"{_scheduleService.FormatTime(t.Time)}"),
                Doctor = _doctorRepo.GetDoctorDetails(schedule.DoctorId)
            };

            return(View(model));
        }
コード例 #3
0
        public ActionResult Details(int id)
        {
            var schedule = _context.Schedules.SingleOrDefault(s => s.Id == id);

            if (schedule == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new ScheduleDetailsViewModel
            {
                Schedule = schedule,
                Ships    = _context.Ships.Where(s => s.ScheduleId == id).ToList()
            };

            return(PartialView("_Details", viewModel));
        }
コード例 #4
0
        public IActionResult GetScheduleDetails(int id)
        {
            Schedule _schedule = _scheduleRepository.GetSingle(t => t.Id == id, t => t.Creator, t => t.Attendees);

            if (_schedule != null)
            {
                ScheduleDetailsViewModel _scheduleDetailsVM = Mapper.Map <Schedule, ScheduleDetailsViewModel>(_schedule);
                foreach (var attendee in _schedule.Attendees)
                {
                    User _userDb = _userRepository.GetSingle(attendee.UserId);
                    _scheduleDetailsVM.Attendees.Add(Mapper.Map <User, UserViewModel>(_userDb));
                }

                return(new OkObjectResult(_scheduleDetailsVM));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #5
0
        public async Task <IActionResult> Index(int?pageNumber, string cinemaName)
        {
            this.ViewData["CurrentFilter"] = cinemaName;

            var movieProjections = Enumerable.Empty <MovieProjectionDetailsViewModel>().AsQueryable();

            if (!string.IsNullOrEmpty(cinemaName))
            {
                movieProjections = await Task.Run(
                    () => this.movieProjectionsService
                    .GetAllMovieProjectionsByCinemaAsQueryeable <MovieProjectionDetailsViewModel>(cinemaName));
            }
            else
            {
                movieProjections = await Task.Run(
                    () => this.movieProjectionsService
                    .GetAllMovieProjectionsAsQueryeable <MovieProjectionDetailsViewModel>());
            }

            var movieProjectionsPaginated = await PaginatedList <MovieProjectionDetailsViewModel>
                                            .CreateAsync(movieProjections, pageNumber ?? 1, SchedulePageSize);

            var latestMovies = await this.moviesService
                               .GetRecentlyAddedMoviesAsync <RecentlyAddedMovieDetailsViewModel>(LatestMoviesCount);

            var cinemas = await this.cinemasService
                          .GetAllCinemasAsync <CinemaDetailsViewModel>();

            var viewModel = new ScheduleDetailsViewModel
            {
                MovieProjections = movieProjectionsPaginated,
                LatestMovies     = latestMovies,
                Cinemas          = cinemas,
            };

            return(this.View(viewModel));
        }