示例#1
0
        public ActionResult AddUsers(int id, Guid? userRef)
        {
            var group = _Storage.GetGroup(id);

            if (userRef == null)
            {
                var userList =
                _Storage.GetUsersNotInGroup(group).Select(
                    u => new SelectListItem { Text = u.Username, Value = u.Id.ToString(), Selected = false });

                var groupUser = new GroupUser
                {
                    Group = group,
                    UserList = userList
                };

                ModelState.AddModelError("UserRef", Localization.getMessage("PleaseSelectUserFromList"));

                return View(groupUser);
            }

            var user = _Storage.GetUser(u => u.Id == userRef.Value);

            _Storage.AddUserToGroup(group, user);

            return RedirectToAction("Details", new { Id = id });
        }
示例#2
0
        public void AddUserToGroup(Group group, User user)
        {
            var db = GetDbContext();

            var groupUser = new GroupUser {GroupRef = group.Id, UserRef = user.Id};

            db.GroupUsers.InsertOnSubmit(groupUser);
            db.SubmitChanges();
        }
示例#3
0
        public ActionResult AddUsers(int id)
        {
            var group = _Storage.GetGroup(id);

            var userList =
                _Storage.GetUsersNotInGroup(group).Select(
                    u => new SelectListItem {Text = u.Username, Value = u.Id.ToString(), Selected = false});

            var groupUser = new GroupUser
                                {
                                    Group = group,
                                    UserList = userList
                                };

            return View(groupUser);
        }
示例#4
0
		private void detach_GroupUsers(GroupUser entity)
		{
			this.SendPropertyChanging();
			entity.Group = null;
		}
示例#5
0
		private void attach_GroupUsers(GroupUser entity)
		{
			this.SendPropertyChanging();
			entity.Group = this;
		}
示例#6
0
 partial void DeleteGroupUser(GroupUser instance);
示例#7
0
 partial void UpdateGroupUser(GroupUser instance);
示例#8
0
 partial void InsertGroupUser(GroupUser instance);