/// <summary> /// Receives the search result request and goes to th database looking for the information. /// </summary> /// <param name="request">A request model that contains the search parameters.</param> /// <returns></returns> public ActionResult SearchResults(FilmSearchModel model) { IList <Film> films = filmDAO.GetFilmsBetween(model.Genre, model.MinLength, model.MaxLength); /* Call the DAL and pass the values as a model back to the View */ return(View(films)); }
/// <summary> /// Receives the search result request and goes to th database looking for the information. /// </summary> /// <param name="request">A request model that contains the search parameters.</param> /// <returns></returns> /// public ActionResult SearchResult(FilmSearchModel films) { /* Call the DAL and pass the values as a model back to the View */ var filmList = dal.GetFilmsBetween(films.Genre, films.MinLength, films.MaxLength); return(View("SearchResult", filmList)); //revisit }
public async Task <List <Film> > GetBySearchModelAsync(FilmSearchModel model) { var searcherResult = await _searchProvider.GetBySearchModelAsync(model); var explorerResult = await _explorerProvider.GetBySearchModelAsync(model); return(searcherResult.Concat(explorerResult).ToList()); }
//public ActionResult Index(FilmSearchModel searchModel) //{ // IndexData model = new IndexData(); // model.Categorys = dal.GetCategoryNames(); // model.Films = dal.GetFilmsBetween(searchModel.Genre, searchModel.MaxLength, searchModel.MinLength); // return View("Index", model); //} /// <summary> /// Receives the search result request and goes to th database looking for the information. /// </summary> /// <param name="request">A request model that contains the search parameters.</param> /// <returns></returns> /// public ActionResult SearchResult(FilmSearchModel searchModel) { IndexData model = new IndexData(); model.Films = dal.GetFilmsBetween(searchModel.Genre, searchModel.MaxLength, searchModel.MinLength); model.Categorys = dal.GetCategoryNames(); return(View("SearchResult", model)); }
public async Task <IActionResult> GetAllBySearchQuery([FromQuery] FilmSearchModel filmSearchModel) { FilmSearchBuilder filmSearchBuilder = new FilmSearchBuilder(FilmSearchModel.Ensure(filmSearchModel)); var tickets = await _filmService.Find(filmSearchBuilder.Build()); tickets.Take(filmSearchModel.Count); return(Ok(tickets)); }
public async Task <List <Film> > GetBySearchModelAsync(FilmSearchModel model) { try { return((await _searcherClient.GetBySearchQueryAsync <Film>(model)).ToList()); } catch { return(new List <Film>()); } }
public async Task <List <Film> > GetBySearchModelCachedAsync(PagedFilmSearchModel model) { var films = await GetAllFromCacheAsync(); var filter = new FilmFilterBuilder(FilmSearchModel.Ensure(model)).Build().Compile(); return(films .Where(filter) .OrderBy(film => film.Name) .Skip(model.Page > 1 ? (model.Page - 1) * PagedFilmSearchModel.PAGE_SIZE : 0) .Take(PagedFilmSearchModel.PAGE_SIZE) .ToList()); }
public static FilmSearchModel Ensure(FilmSearchModel model) { var ensuredModel = new FilmSearchModel(); ensuredModel.Duration = model.Duration; if (model.Name != null) { ensuredModel.Name = model.Name; } if (model.FilmMaker != null) { ensuredModel.FilmMaker = model.FilmMaker; } return(ensuredModel); }
public async Task <List <Film> > GetBySearchModelAsync(FilmSearchModel model) { try { var filmIds = await GetFilmIdsAsync(); var films = await GetFilmByIdsAsync(filmIds); var filter = new FilmFilterBuilder(FilmSearchModel.Ensure(model)).Build().Compile(); return(films.Where(filter).ToList()); } catch { return(new List <Film>()); } }
public async Task <IActionResult> GetAllBySearchQuery([FromQuery] FilmSearchModel filmModel) { var films = _mapper.Map <List <FilmModel> >(await _filmProvider.GetBySearchModelAsync(filmModel)); return(Ok(films)); }
public FilmFilterBuilder(FilmSearchModel searchModel) { SearchModel = searchModel; Filter = PredicateBuilder.True <Film>(); }
/// <summary> /// Receives the search result request and goes to th database looking for the information. /// </summary> /// <param name="request">A request model that contains the search parameters.</param> /// <returns></returns> public ActionResult SearchResult(FilmSearchModel model) { IList <Film> films = filmDAO.GetFilmsBetween(model.Genre, model.MinLength, model.MaxLength); return(View(films)); }
// 1. Add a SearchResult Action public ActionResult SearchResult(FilmSearchModel filmSearch) //7. Add Model as a param { var films = dal.SearchFilms(filmSearch.Title, filmSearch.Description, filmSearch.ReleaseYear, filmSearch.MinLength, filmSearch.MaxLength, filmSearch.Rating); return(View("SearchResult", films)); //8. pass in the films as the model }