Esempio n. 1
0
        public ActionResult GetFilmDate(String dateTime)
        {
            if (dateTime == null)
            {
                return(BadRequest());
            }
            DateTime date;

            try
            {
                date = Convert.ToDateTime(dateTime);
            }
            catch
            {
                ModelState.AddModelError("dateTime", "Недопустимое значение для даты.");
                return(BadRequest(ModelState));
            }

            MockFilmsTimeTable MockFilm;

            List <Film> timeTableFilms = MockFilm.GetFilmsDate(date);

            if (timeTableFilms.Count != 0)
            {
                return(Ok(timeTableFilms));
            }
            return(NotFound());
        }
Esempio n. 2
0
        public ActionResult GetFilmToday()
        {
            MockFilmsTimeTable MockFilm;

            List <Film> timeTableFilms = MockFilm.GetFilmsDate(DateTime.Today);

            if (timeTableFilms.Count != 0)
            {
                return(Ok(timeTableFilms));
            }
            return(NotFound());
        }