コード例 #1
0
        public async Task <IActionResult> RemoveLocation(string id)
        {
            var command = new DeleteAddressCommand(id);

            await _messaging.SendAsync(command);

            return(Ok());
        }
コード例 #2
0
        public void ShouldRequireValidAddressId()
        {
            var command = new DeleteAddressCommand {
                Id = 99999
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().Throw <NotFoundException>();
        }
コード例 #3
0
        public IActionResult Delete([FromBody] DeleteAddressCommand command)
        {
            var result = _handler.Handle(command);

            if (!result.IsValid)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
コード例 #4
0
        public CommandResult Handle(DeleteAddressCommand command)
        {
            var result = command.Validate();

            if (result.IsValid)
            {
                //var address = new Address(command.Id, command.Street, command.City, command.State, command.Country, command.ZipCode, command.Type);
                _repository.Delete(command.Id);
            }

            return(result);
        }
コード例 #5
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                // id validation should be here
                // ...

                var command = new DeleteAddressCommand(id);
                var result  = await _mediator.Send(command);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(new ErrorResponse()
                {
                    ShortInfo = e.Message, AdditionalInfo = e.StackTrace
                }));
            }
        }
コード例 #6
0
 public void DeleteAddress(DeleteAddressCommand command)
 {
     CommandBus.Dispatch(command);
 }
コード例 #7
0
 public void DeleteAddress(DeleteAddressCommand command)
 {
     customerCommandFacade.DeleteAddress(command);
 }