public IActionResult GetById(int filmId)
        {
            var projections = this.projectionsService
                              .GetById <ProjectionViewModel>(filmId);

            var monday    = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Monday);
            var tuesday   = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Tuesday);
            var wednesday = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Wednesday);
            var thursday  = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Thursday);
            var friday    = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Friday);
            var saturday  = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Saturday);
            var sunday    = projections.Where(p => p.ProjectionDateTime.DayOfWeek == DayOfWeek.Sunday);

            var viewModel = new AllProjectionsViewModel
            {
                AllProjections       = projections,
                MondayProjections    = monday,
                TuesDayProjections   = tuesday,
                WednesdayProjections = wednesday,
                ThursdayProjections  = thursday,
                FridayProjections    = friday,
                SaturdayProjections  = saturday,
                SundayProjections    = sunday,
            };

            return(this.View(viewModel));
        }
        public IActionResult All()
        {
            var viewModel = new AllProjectionsViewModel
            {
                AllProjections = this.projectionsService.AllProjections <ProjectionViewModel>().ToList(),
            };

            return(this.View(viewModel));
        }
        public IActionResult ByMovieId(int id)
        {
            var viewModel = new AllProjectionsViewModel
            {
                AllProjections = this.projectionsService
                                 .ProjectionByMovieId <ProjectionViewModel>(id)
                                 .ToList(),
            };

            if (viewModel == null)
            {
                return(this.NotFound());
            }

            return(this.View(viewModel));
        }
        public IActionResult ByCinemaForToday(string cinemaName)
        {
            var viewModel = new AllProjectionsViewModel
            {
                AllProjections = this.projectionsService
                                 .AllProjectionsByCinema <ProjectionViewModel>(cinemaName)
                                 .ToList(),
            };

            if (viewModel == null)
            {
                return(this.NotFound());
            }

            return(this.View(viewModel));
        }
        public IActionResult FoundProjectionsResult(int cinemaId, int?movieId, DateTime?starttime)
        {
            var      projectionsList = new List <ProjectionViewModel>();
            var      viewModel       = new AllProjectionsViewModel();
            int      movieIdToFind   = 0;
            DateTime toFind          = DateTime.UtcNow;

            if (starttime.HasValue)
            {
                DateTime haveDate = starttime.Value;
                if (haveDate.DayOfYear < toFind.DayOfYear)
                {
                    this.ModelState.AddModelError(string.Empty, ErrorBeforeToday);
                    var movies  = this.moviesService.AllMovies <MovieDropdownModel>();
                    var cinemas = this.cinemaService.AllCinemas <CinemaDropdownModel>();

                    var inputViewModel = new FindProjectionInputModel
                    {
                        Cinemas = cinemas,
                        Movies  = movies,
                    };

                    return(this.RedirectToAction("FindProjection", inputViewModel));
                }
            }

            if (starttime == null && movieId != null)
            {
                movieIdToFind   = movieId ?? default;
                projectionsList = this.projectionsService
                                  .ProjectionByMovieIdAndCinemaIdOnly <ProjectionViewModel>(movieIdToFind, cinemaId)
                                  .ToList();
                viewModel.AllProjections = projectionsList;
                return(this.View(viewModel));
            }
            else
            {
                toFind = starttime ?? DateTime.UtcNow;
            }

            if (movieId == null)
            {
                if (toFind.DayOfYear == DateTime.UtcNow.DayOfYear)
                {
                    projectionsList = this.projectionsService
                                      .ProjectionByCinemaIdAndDate <ProjectionViewModel>(cinemaId, toFind)
                                      .Where(x => x.StartTime.Hour > DateTime.UtcNow.AddHours(3).Hour)
                                      .ToList();
                }
                else
                {
                    projectionsList = this.projectionsService
                                      .ProjectionByCinemaIdAndDate <ProjectionViewModel>(cinemaId, toFind)
                                      .ToList();
                }
            }
            else
            {
                if (toFind.DayOfYear == DateTime.UtcNow.DayOfYear)
                {
                    projectionsList = this.projectionsService
                                      .ProjectionByMovieIdAdCinemaId <ProjectionViewModel>((int)movieId, cinemaId, toFind)
                                      .Where(x => x.StartTime.Hour > DateTime.UtcNow.AddHours(3).Hour)
                                      .ToList();
                }
                else
                {
                    projectionsList = this.projectionsService
                                      .ProjectionByMovieIdAdCinemaId <ProjectionViewModel>((int)movieId, cinemaId, toFind)
                                      .ToList();
                }
            }

            viewModel.AllProjections = projectionsList;

            if (viewModel == null)
            {
                return(this.NotFound());
            }

            return(this.View(viewModel));
        }