public ActionResult Remove(Compromisso comp) { try { CompromissoDAO dao = new CompromissoDAO(); dao.Remove(comp); return(RedirectToAction("Agenda", new RouteValueDictionary(new { controller = "Home", action = "Agenda" }))); } catch (Exception e) { Session["msg"] = "Erro: " + e.Message; return(Redirect(Request.UrlReferrer.ToString())); } }
public ActionResult Agenda() { UsuarioDAO dao = new UsuarioDAO(); ViewBag.Not = Session["not"]; Usuario usuario = dao.BuscaPorId(((int)Session["usu"])); CompromissoDAO d = new CompromissoDAO(); ViewBag.Usu = usuario; ViewBag.Compromissos = d.BuscaPorUsuario(usuario.Id); ViewBag.Msg = Session["msg"]; Session["msg"] = ""; return(View()); }