示例#1
0
 public ActionResult Delete(Guid id)
 {
     try
     {
         _agendamentoService.Delete(id);
         return(Ok());
     }
     catch (Exception e)
     {
         string errors = e.Message;
         return(ValidationProblem(new ValidationProblemDetails()
         {
             Type = "Cannot delete",
             Detail = errors
         }));
     }
 }
        public IActionResult Delete(int id)
        {
            try
            {
                var agendamento = _agendamentoService.Delete(id);

                if (!agendamento)
                {
                    return(NoContent());
                }

                return(Ok("Agendamento foi removido com sucesso."));
            }
            catch (System.Exception)
            {
                throw;
            }
        }
示例#3
0
        public IActionResult Delete(int id)
        {
            if (!Exists(id))
            {
                return(NotFound());
            }

            _agendamentoRepository.BeginTransaction();

            // excluindo
            var agendamento = _agendamentoService.Delete(id);

            if (_notification.Any)
            {
                _agendamentoRepository.RollbackTransaction();
                return(BadRequest());
            }

            _agendamentoRepository.CommitTransaction();

            return(Ok(ConvertResult(agendamento)));
        }
 public async Task <ResultDto <bool> > Delete(int id)
 {
     return(await _agendamentoService.Delete(id));
 }