diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index fa3e91e48..e21617596 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -607,7 +607,7 @@ namespace IRaCIS.Core.Application.Service //await VerifyUserPhoneAsync(model.Id, model.UserTypeId, model.Phone); - var user = await _identityUserRepository.Where(t => t.Id == model.Id, true).Include(t => t.UserRoleList)/*.Include(t => t.IdentityUserHospitalGroupList)*/.FirstOrDefaultAsync(); + var user = await _identityUserRepository.Where(t => t.Id == model.Id, true).Include(t => t.UserRoleList).Include(t => t.IdentityUserHospitalGroupList).FirstOrDefaultAsync(); if (user == null) return Null404NotFound(user); @@ -657,15 +657,15 @@ namespace IRaCIS.Core.Application.Service } - //var existHospitalGroupIdList = user.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId).ToList(); + var existHospitalGroupIdList = user.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId).ToList(); - //var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList(); + var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList(); - //user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList(); + user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList(); - //var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList(); + var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList(); - //user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id })); + user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id })); var success = await _identityUserRepository.SaveChangesAsync();