public static void SaveUser(HMEntities.UserProfiles.User user) { HMDal.DataManager dataManager = new HMDal.DataManager(); HMEntities.UserProfiles.UserProfiles userProfiles = dataManager.LoadUserProfiles(); List<HMEntities.UserProfiles.User> userList = userProfiles.userListField; int index = userList.FindIndex(p => p.teamIdField == user.teamIdField); if (index == -1) { // If profile with this TeamId does not exist, add it... userList.Add(user); } else { // ... otherwise, update its data userList[index].CopyData(user); } dataManager.SaveUserProfiles(userProfiles); }
public static void SaveUser(HMEntities.UserProfiles.User user) { HMDal.DataManager dataManager = new HMDal.DataManager(); HMEntities.UserProfiles.UserProfiles userProfiles = dataManager.LoadUserProfiles(); List <HMEntities.UserProfiles.User> userList = userProfiles.userListField; int index = userList.FindIndex(p => p.teamIdField == user.teamIdField); if (index == -1) { // If profile with this TeamId does not exist, add it... userList.Add(user); } else { // ... otherwise, update its data userList[index].CopyData(user); } dataManager.SaveUserProfiles(userProfiles); }