private static async Task InsertFortunes(FortuneContext db) { var fortunes = GetFortunes(); foreach (var fortune in fortunes) { db.Fortunes.Add(fortune); } await db.SaveChangesAsync(); }
internal static void InitializeFortunes() { var fortunes = GetFortunes(); Dictionary <int, Fortune> dict = new Dictionary <int, Fortune>(); foreach (Fortune f in fortunes) { dict.Add(f.Id, f); } FortuneContext = new FortuneContext(dict); }
public FortuneRepository(FortuneContext db) { _db = db; }