public ActionResult DeleteConfirmed(int id) { Projeto projeto = new Projeto(); int LOTipoUsuario = (Int32)Session["tipoUsuario"]; if (LOTipoUsuario < 3 || LOTipoUsuario == 5) // 0 - 2 -> alunos , 5 -> administrador { try { projeto = PR.BuscarPorID(id); PR.DesRelacionarAlunoLiderProjeto(projeto.PRIDprojeto, projeto.PRalunoLider); PR.DesRelacionarAlunoProjeto(projeto.PRIDprojeto); PR.DesRelacionarAvaliadorProjeto(projeto.PRIDprojeto); PR.DesRelacionarOrientadorProjeto(projeto.PRIDprojeto, projeto.PRorientador); PR.Excluir(projeto); return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.Exception = e.ToString(); return(View(projeto)); } } return(RedirectToAction("Entrar", "LoginUsuarios", new { erro = "Apenas Alunos tem acesso a esse recurso" })); }