23 lines
658 B
C#
23 lines
658 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using SPMS.Domain.Entities;
|
|
using SPMS.Domain.Interfaces;
|
|
|
|
namespace SPMS.Infrastructure.Persistence.Repositories;
|
|
|
|
public class BannerRepository : Repository<Banner>, IBannerRepository
|
|
{
|
|
public BannerRepository(AppDbContext context) : base(context) { }
|
|
|
|
public async Task<IReadOnlyList<Banner>> GetActiveListAsync(string? position = null)
|
|
{
|
|
var query = _dbSet.Where(b => b.IsActive);
|
|
|
|
if (!string.IsNullOrWhiteSpace(position))
|
|
query = query.Where(b => b.Position == position);
|
|
|
|
return await query
|
|
.OrderBy(b => b.SortOrder)
|
|
.ToListAsync();
|
|
}
|
|
}
|