public static void UpdateBranchUserRoleForAllBranches(ApplicationDbContext db, Guid appUserId, UserRoleEnum userRole) { List <BranchUser> branchUserEntriesForUser = BranchUserHelpers.GetBranchUsersForUser(appUserId); foreach (BranchUser branchUser in branchUserEntriesForUser) { UpdateBranchUserRole(db, branchUser.BranchUserId, userRole); } }
public static List <Branch> GetBranchesForUser(ApplicationDbContext db, Guid appUserId) { List <BranchUser> branchUserForUser = BranchUserHelpers.GetBranchUsersForUser(db, appUserId); List <Branch> branchesForUser = new List <Branch>(); foreach (BranchUser branchUser in branchUserForUser) { branchesForUser.Add(BranchHelpers.GetBranch(db, branchUser.BranchId)); } List <Branch> branchesForUserDistinct = branchesForUser.Distinct().ToList(); return(branchesForUserDistinct); }