ToursViewModel.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using Microsoft.EntityFrameworkCore;
  6. using Microsoft.Extensions.Logging;
  7. using ReactiveUI;
  8. using TourAgent.Models;
  9. using TourAgent.Views;
  10. namespace TourAgent.ViewModels
  11. {
  12. public class ToursViewModel : ReactiveObject
  13. {
  14. UP_SmirnovContext DB = new UP_SmirnovContext();
  15. private List<Tour>? _tours;
  16. public List<Tour>? Tours { get => _tours; set => this.RaiseAndSetIfChanged(ref _tours, value); }
  17. private List<string>? _types;
  18. public List<string>? Types { get => _types; set => this.RaiseAndSetIfChanged(ref _types, value); }
  19. private bool _checkOrNot = false;
  20. public bool CheckOrNot
  21. {
  22. get => _checkOrNot;
  23. set
  24. {
  25. _checkOrNot = value;
  26. Filter();
  27. }
  28. }
  29. private string? _findTour;
  30. public string? FindTour
  31. {
  32. get => _findTour;
  33. set
  34. {
  35. _findTour = value;
  36. Filter();
  37. }
  38. }
  39. public ToursViewModel()
  40. {
  41. Tours = DB.Tours.ToList();
  42. Types = DB.Types.Select(x=>x.Name).ToList();
  43. Types.Insert(0, "Âñå");
  44. }
  45. public void Filter()
  46. {
  47. }
  48. }
  49. }