using Avalonia.Media; using Avalonia.Media.Imaging; using System; using System.Collections.Generic; using System.IO; using System.Reflection; namespace travel.Models; public partial class Tour { public int Id { get; set; } public int TicketCount { get; set; } public string Name { get; set; } = null!; public string? Description { get; set; } public string? ImagePreview { get; set; } public decimal Price { get; set; } public int IsActual { get; set; } public virtual ICollection Hotels { get; set; } = new List(); public virtual ICollection Types { get; set; } = new List(); public String ActualText { get { if (IsActual == 1) return "Актуален"; else return "Не актуален"; } } public SolidColorBrush ActualColor { get { if (IsActual == 1) return new SolidColorBrush(Colors.Green); else return new SolidColorBrush(Colors.Red); } } public Bitmap Image { get { if(ImagePreview != null && ImagePreview.Length > 0) { string path = "Assets2" + ImagePreview.Replace("/", "\\"); return new Bitmap(path); } else return new Bitmap("Assets2/images/picture.png"); } } }