public WhoIsModule(DiscordSocketClient client, XIVApi xivApi, MasterSpriggansDatabaseContext db) { _xivApi = xivApi; _db = db; _client = client; }
public static async Task SeedDatabase(MasterSpriggansDatabaseContext context, XIVApi xivApi) { // Get the list of titles from the XIVApi Logger.Message("Downloading title list, this may take a moment..."); TitleListResponseModel titleListResponse = await xivApi.GetTitlesList(); if (titleListResponse.Error.HasValue) { throw new Exception(titleListResponse.Message); } else { Logger.Message("Inserting titles into database..."); foreach (var title in titleListResponse.Results) { await context.AddAsync(new XIVTitleModel() { ID = title.ID, Name = title.Name }); } await context.SaveChangesAsync(); } }