29 lines
658 B
C#
29 lines
658 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Nexus.Application.DTOs.Projects;
|
|
using Nexus.Application.Interfaces;
|
|
using Nexus.Infrastructure.Persistence;
|
|
|
|
namespace Nexus.Infrastructure.Services;
|
|
|
|
public class ProjectService : IProjectService
|
|
{
|
|
private readonly NexusDbContext _db;
|
|
|
|
public ProjectService(NexusDbContext db)
|
|
{
|
|
_db = db;
|
|
}
|
|
|
|
public async Task<List<ProjectDto>> GetAllAsync()
|
|
{
|
|
return await _db.Projects
|
|
.Select(p => new ProjectDto
|
|
{
|
|
Id = p.Id,
|
|
Name = p.Name,
|
|
CreatedAt = p.CreatedAt
|
|
})
|
|
.ToListAsync();
|
|
}
|
|
}
|