コード例 #1
0
        /// <summary>
        /// 编辑页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit(int id)
        {
            var model = new DeptModel();

            model = deptService.GetDeptById(id);
            int comId      = Convert.ToInt32(model.CompanyID);
            var lstCompany = companyService.GetPagerCompany(string.Empty, 1, 100);
            var lstDept    = deptService.GetPagerDept(string.Empty, 1, 100, comId);

            ViewBag.CompanyList = new SelectList(lstCompany, "CompanyID", "CompanyName", comId);
            ViewBag.DeptsList   = new SelectList(lstDept, "DeptID", "DeptName", model.DeptID);
            ViewData.Model      = model;
            return(View());
        }