forked from sanchezvem/PyroFetes
Ajout de Login et du model réuni avec tout les autres Sujet
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using PyroFetes.DTO.Product.Request;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Product.Request;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Endpoints.Product;
|
||||
@@ -41,14 +39,20 @@ public class GetProductEndpoint(PyroFetesDbContext db)
|
||||
var responseDto = new GetProductDto
|
||||
{
|
||||
Id = product.Id,
|
||||
Reference = product.References,
|
||||
|
||||
// Le modèle Product contient "Reference" (string), pas "References" (int)
|
||||
Reference = int.TryParse(product.Reference, out var refInt) ? refInt : 0,
|
||||
|
||||
Name = product.Name,
|
||||
Duration = product.Duration,
|
||||
Caliber = product.Caliber,
|
||||
ApprovalNumber = product.ApprovalNumber,
|
||||
Weight = product.Weight,
|
||||
Nec = product.Nec,
|
||||
SellingPrice = product.SellingPrice,
|
||||
|
||||
// Le prix de vente n’est pas dans Product → récupéré via Price
|
||||
SellingPrice = product.Prices.FirstOrDefault()?.SellingPrice ?? 0,
|
||||
|
||||
Image = product.Image,
|
||||
Link = product.Link,
|
||||
ClassificationId = product.ClassificationId,
|
||||
@@ -72,4 +76,4 @@ public class GetProductEndpoint(PyroFetesDbContext db)
|
||||
|
||||
await Send.OkAsync(responseDto, ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user