Beispiel #1
0
        private void CreateDataAboutFilm(int id)
        {
            //Информация о выбранном дне сохраняется в HttpContext.Items["CurrentDay"]
            //По умолчанию равен дате сегодня
            var timeNow    = DateTime.Now;
            var currentDay = timeNow.Date; //new DateTime(timeNow.Year,timeNow.Month, timeNow.Day);

            if (Request.Query.ContainsKey("schedule_date"))
            {
                currentDay = DateTime.ParseExact(
                    Request.Query["schedule_date"],
                    "dd.MM.yyyy", CultureInfo.InvariantCulture);
            }
            HttpContext.Items["CurrentDay"] = currentDay;

            var film = FilmViewModelDAO.GetFilms($"WHERE id = {id}", false).FirstOrDefault();

            FilmViewModel = film;

            FilmViewModel.Actors    = FilmViewModelDAO.GetActorsByFilmId(FilmViewModel.Id);
            FilmViewModel.Producers = FilmViewModelDAO.GetProducersByFilmId(FilmViewModel.Id);
            FilmViewModel.Country   = FilmViewModelDAO.GetCounrtyById(FilmViewModel.CountryId);
            FilmViewModel.Reviews   = FilmViewModelDAO.GetReviewByFilmId(FilmViewModel.Id);
            FilmViewModel.Schedule  = ScheduleDAO.GetSchedule($"id_movie={id} AND date::DATE = '{currentDay:yyyy-MM-dd}'");
        }