예제 #1
0
        // GET: Movies/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var movie      = _service.GetMovieById((int)id);
            var screenings = _service.GetScreeningsByMovieId((int)id);

            if (movie == null || screenings == null)
            {
                return(NotFound());
            }

            ViewBag.Movie      = movie;
            ViewBag.Screenings = screenings;
            return(View());
        }
예제 #2
0
 public ActionResult <MovieDto> GetMovie(int id)
 {
     try
     {
         return((MovieDto)_service.GetMovieById(id));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
 public ActionResult <IEnumerable <ScreeningDto> > GetScreenings(int movieId)
 {
     try
     {
         return(_service
                .GetMovieById(movieId)
                .Screenings.Select(screening => (ScreeningDto)screening).ToList());
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }