public UserData(UserDataModel userDataModel) { UserDataRepository db = new UserDataRepository(); Friends = new Dictionary <string, byte[]>(); this.Id = userDataModel.Id; this.UserName = userDataModel.UserName; this.Avatar = userDataModel.Avatar; this.RecentlyVisitedRooms = userDataModel.RecenltyVisitedRooms; string[] friends = userDataModel.FriendList.Split(','); // Get Friends' metadata foreach (string friend in friends) { if (friend != "") { UserDataModel userModel = db.FindByName(friend); this.Friends.Add(friend, userModel.Avatar); } } }
public void Add(UserDataModel userDataModel) { db.UserDataModels.Add(userDataModel); db.SaveChanges(); }