24 lines
904 B
C#
24 lines
904 B
C#
|
|
namespace SIGCM2.Domain.Exceptions;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Thrown when attempting to add a ProductPrice with a PriceValidFrom that is not strictly
|
||
|
|
/// greater than the currently active price's PriceValidFrom. → HTTP 409
|
||
|
|
/// </summary>
|
||
|
|
public sealed class ProductPriceForwardOnlyException : DomainException
|
||
|
|
{
|
||
|
|
public int ProductId { get; }
|
||
|
|
public DateOnly NewPriceValidFrom { get; }
|
||
|
|
public DateOnly ActivePriceValidFrom { get; }
|
||
|
|
|
||
|
|
public ProductPriceForwardOnlyException(
|
||
|
|
int productId,
|
||
|
|
DateOnly newPriceValidFrom,
|
||
|
|
DateOnly activePriceValidFrom)
|
||
|
|
: base($"El nuevo PriceValidFrom ({newPriceValidFrom:yyyy-MM-dd}) debe ser estrictamente mayor al PriceValidFrom del precio activo ({activePriceValidFrom:yyyy-MM-dd}).")
|
||
|
|
{
|
||
|
|
ProductId = productId;
|
||
|
|
NewPriceValidFrom = newPriceValidFrom;
|
||
|
|
ActivePriceValidFrom = activePriceValidFrom;
|
||
|
|
}
|
||
|
|
}
|