VariantDto.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. namespace qdr.app.studiou.orders2printpack.ProductStorage
  2. {
  3. public class VariantDto : IIdentifierGetter
  4. {
  5. public string Name { get; set; } = string.Empty;
  6. public decimal Price { get; set; } = 0;
  7. public int QuantityMinimum { get; set; } = 0;
  8. public int QuantityMaximum { get; set; } = 0;
  9. public void CopyTo(VariantDto destination)
  10. {
  11. destination.Name = Name;
  12. destination.Price = Price;
  13. destination.QuantityMaximum = QuantityMaximum;
  14. destination.QuantityMinimum = QuantityMinimum;
  15. }
  16. public string GetIdentifier()
  17. {
  18. if (string.IsNullOrWhiteSpace(Name))
  19. return string.Empty;
  20. return Name.ToLower();
  21. }
  22. public override string ToString()
  23. {
  24. if (string.IsNullOrWhiteSpace(Name))
  25. return string.Empty;
  26. return Name.ToLower();
  27. }
  28. bool IEquatable<IIdentifierGetter>.Equals(IIdentifierGetter? other)
  29. {
  30. return other != null && other.GetIdentifier() == GetIdentifier();
  31. }
  32. }
  33. }