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 }); }
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(); }
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); }
private void detach_GroupUsers(GroupUser entity) { this.SendPropertyChanging(); entity.Group = null; }
private void attach_GroupUsers(GroupUser entity) { this.SendPropertyChanging(); entity.Group = this; }
partial void DeleteGroupUser(GroupUser instance);
partial void UpdateGroupUser(GroupUser instance);
partial void InsertGroupUser(GroupUser instance);