public async Task <IActionResult> Delete(RemoverPedidoCommand command) { var result = await _pedidoService.RemoveAsync(command); if (result.Success) { return(Ok("Pedido deletado com sucesso!")); } else { return(BadRequest(result.Messages)); } }
public async Task <ResponseToUser> RemoveAsync(RemoverPedidoCommand command) { var result = _removerValidator.Validate(command); if (!result.IsValid) { return(ErrorResult(result.Errors.Select(q => q.ErrorMessage))); } await _pedidoRepository.DeleteAsync(command.Id); _publisher.Publisher(_pedidoMapper.ConverterPedidoRemovidoEvent(command.Id)); return(SuccessResult()); }
public async Task <string> Delete(int id) { try { RemoverPedidoCommand removerPedidoCommand = new RemoverPedidoCommand(id); await _mediatorHandler.EnviarComando(removerPedidoCommand); } catch (DominioException ex) { return(ex.Message); } catch (Exception ex) { return(ex.Message); } return(null); }
public void RemoverPedido(string id) { var command = new RemoverPedidoCommand(id); _handler.Handle(command); }
public void Handle(RemoverPedidoCommand command) { _repository.DeleteByField("ID", command.ID); }