示例#1
0
        public IActionResult Delete(DareDeleteCommand command)
        {
            var delete = _dareService.Delete(command);

            if (delete.IsError)
            {
                return(BadRequest(delete));
            }
            return(Ok(delete));
        }
示例#2
0
 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);
     }
 }