コード例 #1
0
        public ActionResult Edit(Guid?id)
        {
            var UserModular = new SysUserModular();

            ViewBag.tag = "用户模块新增";
            if (id.HasValue)
            {
                UserModular = _iuserModularService.GetById(id.Value);
                ViewBag.tag = "用户模块编辑";
            }

            //用户
            var ListUser = _isysUserService.GetAll().Select(t => new {
                t.Id,
                t.UserName
            }).ToList();

            ViewBag.Use = new SelectList(ListUser, "Id", "UserName", UserModular.SysUserID);


            //模块
            var ListModual = _imodularService.GetAll().Select(t => new {
                t.Id,
                t.ModularName
            }).ToList();

            ViewBag.Mo = new SelectList(ListModual, "Id", "ModularName", UserModular.ModularID);



            return(View(UserModular));
        }
コード例 #2
0
        public ActionResult Edit(Guid?id, SysUserModular Collection, string ischeck)
        {
            Collection.IsTure = ischeck == "on" ? true : false;

            if (!ModelState.IsValid)
            {
                Edit(id);
                return(View(Collection));
            }
            _iuserModularService.Save(id, Collection);
            _iuserModularService.Commit();

            return(RedirectToAction("Index"));
        }