Ajout du niveau d'experience

This commit is contained in:
2026-06-11 11:06:31 +02:00
parent 35c99928ad
commit 5d16138ed8
16 changed files with 2270 additions and 26 deletions
@@ -1,5 +1,6 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.ExperienceLevel.Response;
using PyroFetes.DTO.ExperienceLevel.Request;
@@ -15,9 +16,20 @@ public class CreateExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext
public override async Task HandleAsync(CreateExperienceLevelDto req, CancellationToken ct)
{
Models.Staff? databaseStaff = await pyroFetesDbContext.Staffs.SingleOrDefaultAsync(x => x.Id == req.StaffId, cancellationToken: ct);
if (databaseStaff == null)
{
await Send.NotFoundAsync(ct);
Console.WriteLine("Customer Type not found");
return;
}
Models.ExperienceLevel experienceLevel = new()
{
Label = req.Label
Label = req.Label,
StaffId = databaseStaff.Id,
};
pyroFetesDbContext.Add(experienceLevel);
await pyroFetesDbContext.SaveChangesAsync(ct);
@@ -26,6 +38,7 @@ public class CreateExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext
{
Id = experienceLevel.Id,
Label = experienceLevel.Label,
StaffId = experienceLevel.StaffId
};
await Send.OkAsync(response, ct);