private fn_show_usergroup ( string username, byte password ) : IQueryable |
||
username | string | |
password | byte | |
Résultat | IQueryable |
/// <summary> /// User aus der User-Gruppe löschen /// </summary> /// <param name="username">Username</param> /// <param name="password">Passwort</param> /// <param name="userId">User Id</param> /// <param name="groupId">Gruppen Id</param> /// <returns>success</returns> public static bool deleteUserFromUsergroup(string username, string password, int userId, int groupId) { bool success = false; //Übergebenes Passwort hashen und in Var pwhash speichern für Übergabe an DB Byte[] pwhash = HelperClass.GetHash(password); using (itin18_aktEntities cont = new itin18_aktEntities()) { List<fn_show_users_Result> sur = cont.fn_show_users(username, pwhash).ToList(); List<fn_show_usergroup_Result> ugr = cont.fn_show_usergroup(username, pwhash).ToList(); string ugrName = ""; foreach (var item in ugr) { if (item.id == groupId) { ugrName = item.groupname; } } foreach (var item in sur) { //Überprüfung der User Id und des Gruppennamens if (item.id == userId && item.group == ugrName) { try { //Löschen des Users aus der UserGruppe cont.sp_delete_user_from_usergroup(username, pwhash, item.id, userId); success = true; } catch (Exception e) { success = false; } } } } return success; }