private void SetProfileCommon(TProfile profile) { if (this is ProfileCommon) { return; } if (profile == null) { return; } profile.Common = ProfileCommon.Select(profile.UserId); }
public override List <TUser> Delete(List <TUser> list) { var profileCommonList = new List <ProfileCommon>(); var profileList = new List <TProfile>(); foreach (var user in list) { if (user != null && user.Profile != null) { profileList.Add(user.Profile); if (user.Profile.Common != null) { profileCommonList.Add(user.Profile.Common); } } } ProfileCommon.Delete(profileCommonList); new TProfile().DataDelete(profileList); return(base.Delete(list)); }
private void SetProfileCommon(IEnumerable <TProfile> profiles) { if (this is ProfileCommon) { return; } if (profiles == null || profiles.Count() == 0) { return; } var userIdList = profiles.Select(item => item.UserId).Distinct(); var commons = ProfileCommon.SelectAll(item => userIdList.Contains(item.UserId)); foreach (var profile in profiles) { if (profile == null) { continue; } profile.Common = commons.FirstOrDefault(item => item.UserId == profile.UserId); } }