TourModel.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. namespace ПодготовкаКДемо1
  11. {
  12. public partial class Tour
  13. {
  14. public string ImageTour { get; set; }
  15. public string IsActualTour { get; set; }
  16. public string IsActualTourColor { get; set; }
  17. public string PriceTour { get; set; }
  18. public static List<Tour> getListTour()
  19. {
  20. List<Tour> tours = BaseConnect.BaseModel.Tour.ToList();
  21. foreach (Tour tour in tours)
  22. {
  23. if (tour.ImagePath != null)
  24. {
  25. tour.ImageTour = tour.ImagePath;
  26. }
  27. else
  28. {
  29. tour.ImageTour = "\\Туры фото\\picture.png";
  30. }
  31. tour.PriceTour = Math.Round(Convert.ToDecimal(tour.Price), 2).ToString();
  32. if (tour.IsActual)
  33. {
  34. tour.IsActualTour = "Актуален";
  35. tour.IsActualTourColor = "#bae3e8";
  36. }
  37. else
  38. {
  39. tour.IsActualTour = "Не актуален";
  40. tour.IsActualTourColor = "#e31e24";
  41. }
  42. }
  43. return tours;
  44. }
  45. }
  46. }