Class1.cs 970 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using WpfApp1;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Runtime.Serialization;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace WpfApp1.model
  9. {
  10. [DataContract]
  11. public class cars
  12. {
  13. [DataMember]
  14. public string name { get; set; }
  15. [DataMember]
  16. public int year { get; set; }
  17. [DataMember]
  18. public double price { get; set; }
  19. [DataMember]
  20. public string color { get; set; }
  21. [DataMember]
  22. public bool defects { get; set; }
  23. [DataMember]
  24. public DateOnly? dateOfLastSTO { get; set; }
  25. [DataMember]
  26. public string? photo { get; set; }
  27. public Uri? ImageBitmap
  28. {
  29. get
  30. {
  31. var imageName = Environment.CurrentDirectory + "/img/" + (photo ?? "");
  32. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  33. }
  34. }
  35. }
  36. }