public async Task <ActionResult> CreateProposal(string TmdbUrl) { var success = false; var message = Resources.ErrorGeneral; var redirectUrl = ""; var tmdbMovieID = TmdbAssistant.ExtractTmdbID(TmdbUrl); if (!string.IsNullOrWhiteSpace(tmdbMovieID)) { var proposal = MovieProposalRepo.GetSingle(TmdbMovieID: tmdbMovieID); if (proposal == null) { var tmdbMovie = await TmdbAssistant.GetMovieAsync(tmdbMovieID); if (tmdbMovie != null) { var xml = MovieProposal.BuildXmlForTX(CurrentUser.ID, tmdbMovie.PremiereCountryIso, tmdbMovie.Title, tmdbMovie.Title.Replace(" ", "-"), tmdbMovie.Overview, "https://www.themoviedb.org/movie/" + tmdbMovieID, tmdbMovieID, tmdbMovie.ReleaseYear, tmdbMovie.PosterUrl, "http://youtu.be/" + tmdbMovie.YoutubeTrailer, false, tmdbMovie.RuntimeMinutes, tmdbMovie.GenreCodes); MovieProposalRepo.TX(0, xml); if (!MovieProposalRepo.IsError && MovieProposalRepo.ID > 0) { success = true; message = Resources.SuccessCreateMovieProposal; redirectUrl = Url.Action("Proposal", "Movies", new { MovieProposalRepo.ID }); } } else { message = Resources.ErrorUrlInvalid; } } else { message = Resources.ErrorDuplicateMovieProposal + string.Format(" <a href=\"{0}\" target=\"_blank\">{1}</a>", Url.Action("Proposal", new { proposal.ID }), proposal.Title); } } else { message = Resources.ErrorUrlInvalid; } return(Json(new { Success = success, Message = message, RedirectUrl = redirectUrl }, JsonRequestBehavior.AllowGet)); }
public ActionResult Proposal(int ID) { var model = MovieProposalRepo.GetSingle(ID); if (model != null) { return(View(model)); } return(HttpNotFound()); }