SPMS_API/SPMS.Infrastructure/Persistence/Repositories/AppConfigRepository.cs

21 lines
690 B
C#

using Microsoft.EntityFrameworkCore;
using SPMS.Domain.Entities;
using SPMS.Domain.Interfaces;
namespace SPMS.Infrastructure.Persistence.Repositories;
public class AppConfigRepository : Repository<AppConfig>, IAppConfigRepository
{
public AppConfigRepository(AppDbContext context) : base(context) { }
public async Task<AppConfig?> GetByKeyAsync(long serviceId, string configKey)
{
return await _dbSet.FirstOrDefaultAsync(c => c.ServiceId == serviceId && c.ConfigKey == configKey);
}
public async Task<IReadOnlyList<AppConfig>> GetAllByServiceAsync(long serviceId)
{
return await _dbSet.Where(c => c.ServiceId == serviceId).ToListAsync();
}
}