// 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()); }
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()); } }