예제 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var deletado = await _repo.GetAllTarefasAsyncById(id);

                if (deletado == null)
                {
                    return(NotFound());
                }

                _repo.Delete(deletado);
                if (await _repo.SaveChangesAsync())
                {
                    return(Ok());
                }
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados falhou"));
            }
            return(BadRequest());
        }
예제 #2
0
 public IActionResult Delete(string id, [FromServices] ITarefaRepository repository)
 {
     repository.Delete(new Guid(id));
     return(Ok());
 }
예제 #3
0
        public IActionResult Delete([FromBody] Guid Id, [FromServices] ITarefaRepository repository)
        {
            repository.Delete(Id);

            return(Ok());
        }
예제 #4
0
 public IActionResult Delete([FromRoute] int id)
 {
     _tarefaRepository.Delete(id);
     return(Ok());
 }
예제 #5
0
        public void Excluir(Guid id)
        {
            _tarefaRepository.Delete(id);

            _unitOfWork.Complete();
        }