Esempio n. 1
0
        public override async Task <Services.GetMovieByIdResponse> GetMovieById(
            Services.GetMovieByIdRequest request,
            ServerCallContext context)
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (!_validator.IsValidGetMovieByIdRequest(request, out var trailers))
            {
                throw NewInvalidArgumentRpcException("Invalid movie id", trailers);
            }

            var movie = await _movieDao
                        .GetMovieById(request.MovieId)
                        .ConfigureAwait(true);

            return(new Services.GetMovieByIdResponse
            {
                Movie = _mapper.Map <Services.Movie>(movie)
            });
        }