public void ChangeActiveParty(int partyIndex, string username) { ApplicationUser user = ApplicationUsers.Include(s => s.Parties).Where(u => u.UserName == username).First(); user.ChangeSelectedPartyIndex(partyIndex); Entry(user).State = EntityState.Modified; }
public Party GetActiveParty(string username) { ApplicationUser user = ApplicationUsers.Include(u => u.Parties).Where(u => u.UserName == username).FirstOrDefault(); int partyIdActiveParty = user.GetActiveParty().Id; var partiesFromUser = Parties.Include(p => p.Characters).Where(p => p.ApplicationUser.UserName == username); return(partiesFromUser.Where(p => p.Id == partyIdActiveParty).FirstOrDefault()); }