Files
Portfolio/src/Portfolio.Api/Services/ProjectRepository.cs
Leon Hoppe aac2f5180b
All checks were successful
Portfolio CI/CD / build (push) Successful in 1m8s
Portfolio CI/CD / test (push) Successful in 1m51s
Portfolio CI/CD / publish (push) Has been skipped
added multithreaded api calling on homepage
2026-02-22 12:22:20 +01:00

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);
}
}