Files
PyroFetes-Sujet1/PyroFetes/Specifications/WarehouseProducts/GetWarehouseProductByProductIdSpec.cs
T
2026-05-24 17:22:03 +01:00

18 lines
497 B
C#

using Ardalis.Specification;
using PyroFetes.Models;
namespace PyroFetes.Specifications.WarehouseProducts;
public sealed class GetWarehouseProductByProductIdSpec : SingleResultSpecification<WarehouseProduct>
{
public GetWarehouseProductByProductIdSpec(int productId, int? warehouseId = null)
{
Query
.Where(x => x.ProductId == productId);
if (warehouseId.HasValue)
{
Query.Where(x => x.WarehouseId == warehouseId.Value);
}
}
}