修改更新用户bug
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
98547ef145
commit
1fd2c01612
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue