// GET: Pads 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); Ads emp = db.AutoGenerate(); ViewBag.autoid = emp; ViewBag.state = new SelectList(model.States, "S_id", "S_name"); ViewBag.category = new SelectList(model.Categories, "C_id", "C_Name"); //ViewBag.menu = menudisplay; return(View(menudisplay)); } }