public async Task <GetMovieResponseModel> GetMovieByIdAsync(Guid movieId, CancellationToken token) { Contract.Requires <Exception>(movieId != Guid.Empty, nameof(movieId)); MovieEntity movieEntity = await _movieRepository.GetMovieByIdAsync(movieId, token); GetMovieResponseModel responseModel = await movieEntity.BuildAdapter().AdaptToTypeAsync <GetMovieResponseModel>(); return(responseModel); }
public async Task <IActionResult> GetMovie([FromQuery] Guid movieId, CancellationToken token = default) { if (movieId == Guid.Empty) { return(BadRequest()); } GetMovieResponseModel result = await _movieService.GetMovieByIdAsync(movieId, token); GetMovieResponseViewModel response = await result.BuildAdapter().AdaptToTypeAsync <GetMovieResponseViewModel>(); if (response == null) { return(NotFound()); } return(Ok(response)); }