VariantDto.cs 1006 B

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