/// <summary> /// Добавление пользователю группы по USER_ID пользователя /// и по ACCESSGROUP_ID группы /// </summary> /// <param name="user_id"></param> /// <param name="accessgroup_id"></param> /// <returns></returns> public void AddUserInAccessGroup(Int64 user_id, Int64 accessgroup_id) { using (SecurityDBEntities db = new SecurityDBEntities()) { UsersInAccessGroups userinaccessgroup = new UsersInAccessGroups(); userinaccessgroup.USER_ID = user_id; userinaccessgroup.ACCESSGROUP_ID = accessgroup_id; db.AddToUsersInAccessGroups(userinaccessgroup); db.SaveChanges(); } }
/// <summary> /// Добавление пользователю группы по логину пользователя /// и по ACCESSGROUP_ID группы /// </summary> /// <param name="user_login"></param> /// <param name="accessgroup_id"></param> /// <returns></returns> public void AddUserInAccessGroup(String user_login, Int64 accessgroup_id) { using (SecurityDBEntities db = new SecurityDBEntities()) { long user_id = (from u in db.Users where (u.LOGIN == user_login) select u.USER_ID).First(); UsersInAccessGroups userinaccessgroup = new UsersInAccessGroups(); userinaccessgroup.USER_ID = user_id; userinaccessgroup.ACCESSGROUP_ID = accessgroup_id; db.AddToUsersInAccessGroups(userinaccessgroup); db.SaveChanges(); } }