mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Changed plugins to abstract classes
This commit is contained in:
1 parent
c9277ecc4e
commit
f63a7b91c8
36 files changed
+657
-300
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
|
||||
public SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
}
|
||||
|
||||
public IQueryable<SettingEntity> GetAll()
|
||||
{
|
||||
return _dbContext.Settings;
|
||||
}
|
||||
|
||||
public async Task<List<SettingEntity>> GetByPluginGuid(Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<SettingEntity> GetByNameAndPluginGuid(string name, Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||
}
|
||||
|
||||
public async Task<SettingEntity> GetByName(string name)
|
||||
{
|
||||
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name);
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user