// GET: Movies/Edit/5 public ActionResult Edit(int id) { try { ViewBag.Genres = getGenres.Execute(new GenreQuery { PerPage = 100 }).Data; ViewBag.Actors = getActors.Execute(new ActorQuery { PerPage = 1000 }).Data; ViewBag.Languages = getLanguages.Execute(new LanguageQuery()).Data; ViewBag.Writers = getWriters.Execute(new WriterQuery { PerPage = 1000 }).Data; ViewBag.Countries = getCountries.Execute(new CountryQuery()).Data; ViewBag.Productions = getProductions.Execute(new ProductionQuery()).Data; ViewBag.Rateds = getRateds.Execute(new RatedQuery()).Data; return(View(getMovie.Execute(id))); } catch (Exception e) { TempData["error"] = e.Message; } return(RedirectToAction(nameof(Edit))); }
public IActionResult Get(int id) { try { return(Ok(getMovie.Execute(id))); } catch (EntityNotFoundException e) { return(NotFound(new { Errors = new List <string> { e.Message } })); } catch (Exception e) { return(StatusCode(500, new { Errors = new List <string> { e.Message } })); } }
public ActionResult Movies(int id) { try { ViewBag.User = HttpContext.Session.Get <ShowUserDto>("User"); ViewBag.Actors = getActors.Execute(new ActorQuery { MovieId = id }).Data; ViewBag.Projections = getProjections.Execute(new ProjectionQuery { MovieId = id, PerPage = 100 }).Data; ViewBag.Posters = getPosters.Execute(new PosterQuery { MovieId = id }).Data; ViewBag.Comments = getComments.Execute(new CommentQuery { MovieId = id }).Data; return(View(getMovie.Execute(id))); } catch (Exception e) { TempData["error"] = e.Message; return(RedirectToAction("Movies", new { id })); } }
public IActionResult Get([FromQuery] MovieSearch obj) { try { var movies = _getMovie.Execute(obj); return(Ok(movies)); } catch { return(StatusCode(500)); } }
// GET: Movie public ActionResult Index([FromQuery] MovieSearch obj) { var movies = _getMovies.Execute(obj); var modelMovies = movies.Select(p => new MovieViewModel { Id = p.Id, Title = p.Title, ImdbRating = p.ImdbRating, Plot = p.Plot, Runtime = p.Runtime, Released = p.Released, Genres = p.Genres.Select(g => new GenreViewModel { Name = g.Name }).ToList() }); return(View(modelMovies)); }