Tour.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Avalonia.Media;
  2. using Avalonia.Media.Imaging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Reflection;
  7. namespace travel.Models;
  8. public partial class Tour
  9. {
  10. public int Id { get; set; }
  11. public int TicketCount { get; set; }
  12. public string Name { get; set; } = null!;
  13. public string? Description { get; set; }
  14. public string? ImagePreview { get; set; }
  15. public decimal Price { get; set; }
  16. public int IsActual { get; set; }
  17. public virtual ICollection<Hotel> Hotels { get; set; } = new List<Hotel>();
  18. public virtual ICollection<Type> Types { get; set; } = new List<Type>();
  19. public String ActualText
  20. {
  21. get
  22. {
  23. if (IsActual == 1)
  24. return "Актуален";
  25. else
  26. return "Не актуален";
  27. }
  28. }
  29. public SolidColorBrush ActualColor
  30. {
  31. get
  32. {
  33. if (IsActual == 1)
  34. return new SolidColorBrush(Colors.Green);
  35. else
  36. return new SolidColorBrush(Colors.Red);
  37. }
  38. }
  39. public Bitmap Image
  40. {
  41. get
  42. {
  43. if(ImagePreview != null && ImagePreview.Length > 0)
  44. {
  45. string path = "Assets2" + ImagePreview.Replace("/", "\\");
  46. return new Bitmap(path);
  47. }
  48. else return new Bitmap("Assets2/images/picture.png");
  49. }
  50. }
  51. }