public ActionResult Delete(int id) { if (_repository.Buscar(id) == null) { return(NotFound()); } _repository.Remover(id); _repository.Salvar(); return(NoContent()); }
public IActionResult Delete(Servico servico) { try { _servicoRepository.Remover(servico); return(RedirectToAction("Index")); } catch (Exception ex) { return(BadRequest($"Erro: {ex.Message}")); } }
public async Task <IActionResult> DeleteConfirmed(Guid id) { var servicoViewModel = _mapper.Map <ServicoViewModel>(await _contexto.ObterPorId(id)); if (servicoViewModel == null) { return(NotFound()); } await _contexto.Remover(id); return(RedirectToAction("Index")); }
public async Task Remover(Guid id) { await _servicoRepository.Remover(id); }
public void Excluir(int id) { _servicoRepository.Remover(id); }