Exemple #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());
 }
Exemple #2
0
 public void CreateCharacter(CharacterModel character)
 {
     using var context = new CharacterContext(configuration);
     context.Add(character);
     context.SaveChanges();
 }
Exemple #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));
 }
Exemple #4
0
 public void Migrate()
 {
     using var context = new CharacterContext(configuration);
     context.Database.Migrate();
 }