SPMS_API/SPMS.Infrastructure/Persistence/Repositories/FaqRepository.cs
2026-02-10 13:57:17 +09:00

23 lines
687 B
C#

using Microsoft.EntityFrameworkCore;
using SPMS.Domain.Entities;
using SPMS.Domain.Interfaces;
namespace SPMS.Infrastructure.Persistence.Repositories;
public class FaqRepository : Repository<Faq>, IFaqRepository
{
public FaqRepository(AppDbContext context) : base(context) { }
public async Task<IReadOnlyList<Faq>> GetActiveListAsync(long serviceId, string? category = null)
{
var query = _dbSet.Where(f => f.ServiceId == serviceId && f.IsActive);
if (!string.IsNullOrWhiteSpace(category))
query = query.Where(f => f.Category == category);
return await query
.OrderBy(f => f.SortOrder)
.ToListAsync();
}
}