Esempio n. 1
0
 /// <summary>
 /// Return all <see cref="CharacterModel"/> for supplied account id.
 /// </summary>
 public List <CharacterModel> GetCharacters(uint accountId)
 {
     using var context = new CharacterContext(configuration);
     return(context.Characters
            .Where(c => c.AccountId == accountId)
            .ToList());
 }
Esempio n. 2
0
 public void CreateCharacter(CharacterModel character)
 {
     using var context = new CharacterContext(configuration);
     context.Add(character);
     context.SaveChanges();
 }
Esempio n. 3
0
 public CharacterModel GetCharacter(uint accountId, uint characterId)
 {
     using var context = new CharacterContext(configuration);
     return(context.Characters.SingleOrDefault(c => c.Id == characterId && c.AccountId == accountId));
 }
Esempio n. 4
0
 public void Migrate()
 {
     using var context = new CharacterContext(configuration);
     context.Database.Migrate();
 }