Theme Viewer + Theme Updater (#2952)

This commit is contained in:
Joe Milazzo 2024-05-13 17:00:13 -05:00 committed by GitHub
parent 24302d4fcc
commit 38e7c1c131
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 4563 additions and 284 deletions

View file

@ -19,6 +19,8 @@ public interface ISiteThemeRepository
Task<SiteThemeDto?> GetThemeDtoByName(string themeName);
Task<SiteTheme> GetDefaultTheme();
Task<IEnumerable<SiteTheme>> GetThemes();
Task<SiteTheme?> GetTheme(int themeId);
Task<bool> IsThemeInUse(int themeId);
}
public class SiteThemeRepository : ISiteThemeRepository
@ -88,6 +90,19 @@ public class SiteThemeRepository : ISiteThemeRepository
.ToListAsync();
}
public async Task<SiteTheme> GetTheme(int themeId)
{
return await _context.SiteTheme
.Where(t => t.Id == themeId)
.FirstOrDefaultAsync();
}
public async Task<bool> IsThemeInUse(int themeId)
{
return await _context.AppUserPreferences
.AnyAsync(p => p.Theme.Id == themeId);
}
public async Task<SiteThemeDto?> GetThemeDto(int themeId)
{
return await _context.SiteTheme