23 lines
687 B
C#
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();
|
|
}
|
|
}
|