public LadderInspector(string apiKey, QueueDodgeDB queueDodge, IMemoryCache cache, Func <string, Task> sendMessage) { this.apiKey = apiKey; this.queueDodge = queueDodge; this.cache = cache; this.sendMessage = sendMessage; }
public LadderChange SaveCharacter(LadderChange change, QueueDodgeDB queueDodge) { var characterExists = queueDodge .Characters .Any(p => p.Name == change.Current.Character.Name && p.RealmID == change.Current.Character.RealmID); if (!characterExists) { queueDodge.Entry(change.Current.Character).State = EntityState.Added; //var attachedCharacter = queueDodge.Add(change.Current.Character).Entity; queueDodge.SaveChanges(); } var character = queueDodge .Characters .Include(p => p.Class) .Include(p => p.Realm) .Include(p => p.Specialization) .Include(p => p.Race) .Include(p => p.Realm.Region) .Include(p => p.Race.Faction) .Where(p => p.Name == change.Current.Character.Name && p.RealmID == change.Current.Character.RealmID) .Single(); change.Current.Character = character; change.Previous.Character = character; return(change); }
public LadderChange SaveLadderChange(LadderChange change, QueueDodgeDB queueDodge) { var changeModel = new LadderChangeModel(change); changeModel.CharacterID = change.Current.Character.ID; queueDodge.LadderChanges.Add(changeModel); return(change); }
public LadderChange SaveRealm(LadderChange change, QueueDodgeDB queueDodge) { var realmExists = queueDodge .Realms .Any(p => p.ID == change.Current.Character.RealmID); if (!realmExists) { var realm = new Realm(change.Current.Character.RealmID, change.Current.Character.Realm.Name, change.Current.Character.Realm.Slug, change.Current.Character.Realm.RegionID); var trackedRealm = queueDodge.Realms.Add(realm); queueDodge.SaveChanges(); } return(change); }
public QueueDodgeSeed(QueueDodgeDB queueDodge, IOptions <QueueDodgeOptions> options) { this.queueDodge = queueDodge; this.options = options.Value; }