public ActionResult Delete(int id) { var competencia = _competenciaRepository.Get(id); if (competencia != null) { _competenciaRepository.Delete(competencia.Id); return(RedirectToAction(nameof(Index))); } return(View()); }