diff --git a/src/FilterLists.Api/V1/Controllers/EntityController.cs b/src/FilterLists.Api/V1/Controllers/EntityController.cs index c2212e23e..cb6cd746b 100644 --- a/src/FilterLists.Api/V1/Controllers/EntityController.cs +++ b/src/FilterLists.Api/V1/Controllers/EntityController.cs @@ -1,5 +1,7 @@ using System; using System.Threading.Tasks; +using FilterLists.Data.Entities; +using FilterLists.Services.Models.Seed; using FilterLists.Services.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; @@ -30,37 +32,37 @@ private async Task GetSeed(string controllerName) return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllFilterLists()); + return Json(await SeedService.GetAll()); }); case "languages": return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllLanguages()); + return Json(await SeedService.GetAll()); }); case "licenses": return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllLicenses()); + return Json(await SeedService.GetAll()); }); case "maintainers": return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllMaintainers()); + return Json(await SeedService.GetAll()); }); case "software": return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllSoftware()); + return Json(await SeedService.GetAll()); }); case "syntaxes": return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry => { entry.SlidingExpiration = TimeSpan.FromSeconds(3); - return Json(await SeedService.GetAllSyntaxes()); + return Json(await SeedService.GetAll()); }); default: return await Task.FromResult(NotFound()); diff --git a/src/FilterLists.Services/Services/SeedService.cs b/src/FilterLists.Services/Services/SeedService.cs index 72deb4cf0..bb75b7758 100644 --- a/src/FilterLists.Services/Services/SeedService.cs +++ b/src/FilterLists.Services/Services/SeedService.cs @@ -2,8 +2,6 @@ using System.Threading.Tasks; using AutoMapper.QueryableExtensions; using FilterLists.Data; -using FilterLists.Data.Entities; -using FilterLists.Services.Models.Seed; using Microsoft.EntityFrameworkCore; namespace FilterLists.Services.Services @@ -17,34 +15,9 @@ public SeedService(FilterListsDbContext filterListsDbContext) this.filterListsDbContext = filterListsDbContext; } - public async Task> GetAllFilterLists() + public async Task> GetAll() where TEntity : class { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); - } - - public async Task> GetAllLanguages() - { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); - } - - public async Task> GetAllLicenses() - { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); - } - - public async Task> GetAllMaintainers() - { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); - } - - public async Task> GetAllSoftware() - { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); - } - - public async Task> GetAllSyntaxes() - { - return await filterListsDbContext.Set().ProjectTo().ToListAsync(); + return await filterListsDbContext.Set().ProjectTo().ToListAsync(); } } } \ No newline at end of file