public virtual ActionResult CreateGroup(FormCollection collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var newgroup = new UserGroup();
             TryUpdateModel(newgroup);
             Repository.Add(newgroup);
             Repository.Save();
             if (Request.IsAjaxRequest())
             {
                 return Content("用户已添加成功");
             }
             return RedirectToAction(MVC.Users.UserGroupList());
         }
         return View();
     }
     catch
     {
         return View();
     }
 }
Exemplo n.º 2
0
        private void FixupUserGroup(UserGroup previousValue)
        {
            if (previousValue != null && previousValue.Users.Contains(this))
            {
                previousValue.Users.Remove(this);
            }

            if (UserGroup != null)
            {
                if (!UserGroup.Users.Contains(this))
                {
                    UserGroup.Users.Add(this);
                }
                if (GroupId != UserGroup.GroupId)
                {
                    GroupId = UserGroup.GroupId;
                }
            }
            else if (!_settingFK)
            {
                GroupId = null;
            }
        }
Exemplo n.º 3
0
        private void FixupUserGroup(UserGroup previousValue)
        {
            if (previousValue != null && previousValue.TaskNodes.Contains(this))
            {
                previousValue.TaskNodes.Remove(this);
            }

            if (UserGroup != null)
            {
                if (!UserGroup.TaskNodes.Contains(this))
                {
                    UserGroup.TaskNodes.Add(this);
                }
                if (ProcessGroup != UserGroup.GroupId)
                {
                    ProcessGroup = UserGroup.GroupId;
                }
            }
        }