finalisation des endpoints
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using FastEndpoints;
|
||||
using PF3.DTO.SoundCategory.Request;
|
||||
using PF3.DTO.SoundCategory.Response;
|
||||
using PF3.Models;
|
||||
using PyroFetes.DTO.SoundCategory.Request;
|
||||
using PyroFetes.DTO.SoundCategory.Response;
|
||||
|
||||
namespace PF3.Endpoints.SoundCategory;
|
||||
namespace PyroFetes.Endpoints.SoundCategory;
|
||||
|
||||
public class CreateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<CreateSoundCategoryDto, ReadSoundCategoryDto>
|
||||
public class CreateSoundCategoryEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateSoundCategoryDto, ReadSoundCategoryDto>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
@@ -15,13 +14,13 @@ public class CreateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<C
|
||||
|
||||
public override async Task HandleAsync(CreateSoundCategoryDto req, CancellationToken ct)
|
||||
{
|
||||
var soundCategory = new Models.SoundCategory
|
||||
var soundCategory = new PyroFetes.Models.SoundCategory
|
||||
{
|
||||
Name = req.Name,
|
||||
};
|
||||
|
||||
pf3DbContext.SoundsCategorys.Add(soundCategory);
|
||||
await pf3DbContext.SaveChangesAsync(ct);
|
||||
pyroFetesDbContext.SoundCategories.Add(soundCategory);
|
||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
||||
|
||||
var result = new ReadSoundCategoryDto
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user