// Retreive specific movies with provided filters public List <MovieDtoOutput> GetMoviesFilter(SearchMovieFilter filter) { var query = GetAllMovies(); switch (filter.SortBy) { case "title": if (filter.Order == "asc") { query = query.OrderBy(k => k.Title); } else { query = query.OrderByDescending(k => k.Title); } break; case "directorName": if (filter.Order == "asc") { query = query.OrderBy(k => k.Director.Name); } else { query = query.OrderByDescending(k => k.Director.Name); } break; } return(_mapper.Map <List <MovieDtoOutput> >(query.ToList())); }
public IEnumerable <MovieDtoOutput> GetMovies([FromQuery] SearchMovieFilter filter) { return(_movieProcess.GetMoviesFilter(filter)); }