public IActionResult Delete(DareDeleteCommand command) { var delete = _dareService.Delete(command); if (delete.IsError) { return(BadRequest(delete)); } return(Ok(delete)); }
public ICommandResult Delete(DareDeleteCommand command) { try { var dare = _dareRepository.Read(command.Id); _dareRepository.Delete(dare); var commandResult = new CommandResult("Desafio deletado com sucesso!", dare, false); return(commandResult); } catch (Exception ex) { var commandResult = new CommandResult($"{ex.InnerException.Message}", null, true); return(commandResult); } }