public async Task <GenericCommandResult <ClientEntity> > Repprove([FromServices] IClientHandler handler,
                                                                          [FromBody] RepproveClientCommand command)
        {
            var result = (GenericCommandResult <ClientEntity>) await handler.HandleAsync(command);

            return(result);
        }
        public RepproveClientHandlerTests()
        {
            _repository = Substitute.For <IClientRepository>();
            _handler    = new ClientHandler(_repository);

            _commandWithoutId = _fixture
                                .Build <RepproveClientCommand>()
                                .Without(x => x.Id)
                                .Create();
        }
Exemple #3
0
        public RepproveClientCommandTests()
        {
            _commandWithoutId = _fixture
                                .Build <RepproveClientCommand>()
                                .With(x => x.Id, 0)
                                .Create();

            _commandWithId = _fixture
                             .Build <RepproveClientCommand>()
                             .With(x => x.Id, _fixture.Create <int>())
                             .Create();
        }
Exemple #4
0
        public async Task <ICommandResult> HandleAsync(RepproveClientCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult <ClientEntity>(false, command.Notifications));
            }

            var client = await _repository.GetAsync(command.Id);

            client.SetRepproved();
            await _repository.UpdateAsync(client);

            return(new GenericCommandResult <ClientEntity>(true, client));
        }