Example #1
0
 public async static Task SeedResponseModes(MockifyDbContext context)
 {
     if (!context.ResponseModes.Any())
     {
         context.AddRange(SpecialResponseMode.SpecialResponseModes);
         await context.SaveChangesAsync();
     }
 }
Example #2
0
 public async static Task SeedServerSettings(MockifyDbContext context)
 {
     if (!context.ServerSettings.Any())
     {
         ServerSettings.Settings = ServerSettings.DEFAULT;
         context.Add(ServerSettings.Settings.RateLimits);
         context.Add(ServerSettings.Settings);
         await context.SaveChangesAsync();
     }
     else
     {
         ServerSettings.Settings = await context.ServerSettings.Include(x => x.RateLimits).Include(x => x.ResponseMode).OrderBy(x => x.ServerSettingsId).FirstAsync();
     }
 }