public void Delete(int id) { if (!_pessoaRepositorio.Excluir(id)) { var resp = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.NotFound) { Content = new System.Net.Http.StringContent(string.Format("Não há pessoas com esse codigo ID = {0}", id)), ReasonPhrase = " Not Found" }; } }
public async Task <IActionResult> Delete(int id) { if (id == 0) { return(BadRequest()); } var pessoa = await _pessoaRepositorio.ObterPorId(id); _pessoaRepositorio.Excluir(pessoa); await _unitOfWork.SaveChanges(); var response = new ResponseModel <PessoaDetalhesModel>(HttpStatusCode.OK, new PessoaDetalhesModel(pessoa), "Pessoa excluída com sucesso"); return(Ok(response)); }
public void Delete(int id) { repositorio.Excluir(id); }