public MoviesController() { _createMovieCommand = new CreateMovieCommand(); _deleteMovieCommand = new DeleteMovieCommand(); _getAllMoviesQuery = new GetAllMoviesQuery(); _searchMoviesQuery = new SearchMoviesQuery(); _editMovieCommand = new EditMovieCommand(); }
public async Task <ActionResult <PagedResultModel <MovieDetailsModel> > > GetAll([FromQuery] PagedQueryModel model, CancellationToken cancellationToken) { var query = new GetAllMoviesQuery(model.Page, model.Size); var result = await Executor.ExecuteAsync(query, cancellationToken); return(Ok(result)); }
public IEnumerable <Movie> GetAll([FromUri] int offset = 25) { var query = new GetAllMoviesQuery(offset); query.Validate(); query.Build(); var results = this.moviesRepository.Execute(query); return(results); }
public async Task <IActionResult> GetAllMoviesAsync() { var request = new GetAllMoviesQuery(); var response = await _mediator.Send(request); if (response == null) { return(NotFound()); } var mappedResponse = _mapper.Map <IList <GetMovieResponse> >(response); return(mappedResponse != null ? (IActionResult)Ok(mappedResponse) : NotFound()); }
public async Task <IList <Movie> > Handle(GetAllMoviesQuery request, CancellationToken cancellationToken) { return(await _context.Movies.ToListAsync(cancellationToken)); }
public async Task <IEnumerable <Movie> > Handle(GetAllMoviesQuery query, CancellationToken cancellationToken) { var movies = new List <Movie>(); return(await Task.FromResult(movies)); }