コード例 #1
0
ファイル: MoviesController.cs プロジェクト: Tpuljak/FinalTask
 public MoviesController()
 {
     _createMovieCommand = new CreateMovieCommand();
     _deleteMovieCommand = new DeleteMovieCommand();
     _getAllMoviesQuery  = new GetAllMoviesQuery();
     _searchMoviesQuery  = new SearchMoviesQuery();
     _editMovieCommand   = new EditMovieCommand();
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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());
        }
コード例 #5
0
 public async Task <IList <Movie> > Handle(GetAllMoviesQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Movies.ToListAsync(cancellationToken));
 }
コード例 #6
0
        public async Task <IEnumerable <Movie> > Handle(GetAllMoviesQuery query, CancellationToken cancellationToken)
        {
            var movies = new List <Movie>();

            return(await Task.FromResult(movies));
        }