24 lines
772 B
C#
24 lines
772 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Portfolio.Shared.Models;
|
|
using Portfolio.Shared.Services;
|
|
|
|
namespace Portfolio.Api.Services;
|
|
|
|
internal sealed class ProjectRepository(DatabaseContext context) : IProjectRepository {
|
|
|
|
public async Task<IEnumerable<Project>> GetProjects(CancellationToken ct) {
|
|
return await context.Projects
|
|
.Include(p => p.Languages)
|
|
.OrderByDescending(p => p.OrderIndex)
|
|
.ToArrayAsync(ct);
|
|
}
|
|
|
|
public async Task<IEnumerable<Project>> GetFeaturedProjects(CancellationToken ct) {
|
|
return await context.Projects
|
|
.Include(p => p.Languages)
|
|
.Where(p => p.Featured)
|
|
.OrderByDescending(p => p.OrderIndex)
|
|
.ToArrayAsync(ct);
|
|
}
|
|
|
|
} |