public IActionResult Search(MovieSearchModel searchModel) { if (!string.IsNullOrWhiteSpace(searchModel.Title)) { searchModel.Title = searchModel.Title.Trim(); } if (SessionValueExists("movie-query")) { searchModel.Title = GetStringFromSession("movie-query"); } if (SessionValueExists("wish")) { searchModel.Title = GetFromSession <string>("wish"); } if (Request.Headers["Referrer"].Contains("/Movie/Search") && string.IsNullOrWhiteSpace(searchModel.Title)) { ShowStatusMessage(MessageTypeEnum.error, "Please enter search terms.", "Search Error"); return(View(searchModel)); } if (!string.IsNullOrWhiteSpace(searchModel.Title)) { searchModel.MovieResults = _tmdbService.SearchMovies(searchModel.Title); searchModel.TVShowResults = _tmdbService.SearchTV(searchModel.Title); foreach (var result in searchModel.MovieResults) { result.poster_path = string.Format("https://image.tmdb.org/t/p/w300{0}", result.poster_path); } foreach (var result in searchModel.TVShowResults) { result.poster_path = string.Format("https://image.tmdb.org/t/p/w300{0}", result.poster_path); } } ViewBag.Title = "Movie/TV Show Search"; return(View(searchModel)); }