mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
27 lines
754 B
C#
27 lines
754 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using WebApp.Data;
|
|
using WebApp.Mapping;
|
|
|
|
namespace WebApp.Endpoints;
|
|
|
|
public static class SkillsEndpoints
|
|
{
|
|
const string GetSkillEndpointName = "GetSkill";
|
|
|
|
public static RouteGroupBuilder MapSkillsEndpoints(this WebApplication app)
|
|
{
|
|
var group = app.MapGroup("api/skills").WithParameterValidation();
|
|
|
|
// GET /skills
|
|
group.MapGet("/",
|
|
async (ApplicationDbContext dbContext) =>
|
|
await dbContext.Skills
|
|
.OrderBy(Sk => Sk.SkillId)
|
|
.Select(Sk => Sk.ToSkillSummaryDto()) // SkillSummaryDto
|
|
.AsNoTracking()
|
|
.ToListAsync());
|
|
|
|
return group;
|
|
}
|
|
}
|