public ActionResult LoginManage() { IEnumerable <LoginModel> codes2 = LoginModel.List((Int16)Session["UserLevel"], (byte?)Session["UserdepartmentId"]); ViewBag.AccountList = from c in codes2 select c; ViewBag.sessionType = from c in LoginModel.SessionLevel((Int16)Session["UserLevel"]) select new SelectListItem { Value = c.level_id.ToString(), Text = c.Level }; if ((Int16)Session["UserLevel"] >= 998) { ViewBag.department_info = from d in ListModel.GetDepartmentList() select new SelectListItem { Value = d.Value, Text = d.Text }; } else { ViewBag.department_info = from d in ListModel.GetDepartmentList() where d.Value == Session["UserdepartmentId"].ToString() select new SelectListItem { Value = d.Value, Text = d.Text }; } ViewBag.bar = "Account"; return(View()); }