private MovieRemoveCommand MovieRemoveCommandData()
        {
            var movieRemoveCommand = new MovieRemoveCommand()
            {
                MovieIdentity = Guid.Parse("4a1c7726-5a52-42df-b3ac-0c862f341cb9")
            };

            return(movieRemoveCommand);
        }
Пример #2
0
        public async Task <Result <Exception, Core.Results.Unit> > Handle(MovieRemoveCommand request, CancellationToken cancellationToken)
        {
            var findMovieCallback = await _movieRepository.GetById(request.MovieId);

            if (findMovieCallback.IsFailure)
            {
                return(findMovieCallback.Failure);
            }

            findMovieCallback.Success.SetAsRemoved();

            var updateGenreCallback = await _movieRepository.UpdateAsync(findMovieCallback.Success);

            if (updateGenreCallback.IsFailure)
            {
                return(updateGenreCallback.Failure);
            }

            return(Unit.Successful);
        }
 public async Task <bool> OnMovieRemoveAsync([FromBody] MovieRemoveCommand movieRemoveCommand)
 => await mediator.Send <bool>(movieRemoveCommand);