public async Task <IActionResult> RemoveLocation(string id) { var command = new DeleteAddressCommand(id); await _messaging.SendAsync(command); return(Ok()); }
public void ShouldRequireValidAddressId() { var command = new DeleteAddressCommand { Id = 99999 }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <NotFoundException>(); }
public IActionResult Delete([FromBody] DeleteAddressCommand command) { var result = _handler.Handle(command); if (!result.IsValid) { return(BadRequest(result)); } return(Ok(result)); }
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); }
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 })); } }
public void DeleteAddress(DeleteAddressCommand command) { CommandBus.Dispatch(command); }
public void DeleteAddress(DeleteAddressCommand command) { customerCommandFacade.DeleteAddress(command); }