public ActionResult Index() { if (Session["U_id"] == null) { return(RedirectToAction("Index", "Home")); } else { AP_Menu menu = new AP_Menu(); var r = Convert.ToInt32(Session["U_id"]); var user_id = r; var Menulist = db.user_rights(user_id); List <AP_Menu> menudisplay = menu.Menutree(Menulist, null); //ViewBag.menu = menudisplay; login login = db.user_profile(r); ViewBag.data = login; return(View(menudisplay)); } }