public void InitializeVm() { PersonalContactList.Clear(); AllPlayers.Clear(); List <ContactEntity> contactsFromBL = contactsBL.GetUserContactsOfPlayer( new PlayerEntity() { Username = Cache.Instance.username } ); foreach (ContactEntity contactBL in contactsFromBL) { PlayerEntity p = playersBL.GetPlayerByUsername(contactBL.UserName); PersonalContactList.Add(new ContactVM(contactBL.UserName, contactBL.ContactInfo, p.FirstName, p.LastName)); } List <PlayerEntity> playersFromBL = playersBL.GetAllPlayers(PersonalContactList.Select(c => c.UserName).Concat(new List <string>() { Cache.Instance.username }).ToList()); foreach (PlayerEntity playerBL in playersFromBL) { AllPlayers.Add(new PlayerVM(playerBL.Username, playerBL.FirstName, playerBL.LastName)); } }
public HomePageVM() { playersBL = new PlayersBL(); PlayerEntity p = playersBL.GetPlayerByUsername(Cache.Instance.username); //PlayerEntity p = playersBL.GetPlayerByUsername("BotBurg3r"); this.Player = new PlayerVM(p.Username, p.FirstName, p.LastName); }
public ProfilePageVM() { playersBL = new PlayersBL(); contactsBL = new ContactsBL(); PlayerEntity p = playersBL.GetPlayerByUsername(Cache.Instance.username); //PlayerEntity p = playersBL.GetPlayerByUsername("BotBurg3r"); this.Player = new PlayerVM(p.Username, p.FirstName, p.LastName); ContactEntity itemFromBL = this.contactsBL.GetPlayerInfo(p.Username); this.Contact = new ContactVM(p.Username, p.FirstName, p.LastName); foreach (string infoItem in itemFromBL.ContactInfo) { this.Contact.Info.Add(infoItem); } this.phone = GetInfoProp("Phone"); this.email = GetInfoProp("Email"); }