|
@@ -10,22 +10,19 @@ namespace UPtur.ViewModels
|
|
{
|
|
{
|
|
UpPrytovContext DB = new UpPrytovContext();
|
|
UpPrytovContext DB = new UpPrytovContext();
|
|
private List<Tour>? _tours;
|
|
private List<Tour>? _tours;
|
|
- public List<Tour>? Tours { get => _tours; set => this.RaiseAndSetIfChanged(ref _tours, value); }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public List<Tour>? Tours { get => _tours; set => this.RaiseAndSetIfChanged(ref _tours, value); }//ëèñò äëÿ òóðîâ
|
|
|
|
|
|
private static List<string>? _types;
|
|
private static List<string>? _types;
|
|
- public static List<string>? Types { get => _types; set => _types = value; }
|
|
|
|
|
|
+ public static List<string>? Types { get => _types; set => _types = value; }//ëèñò äëÿ òèïîâ
|
|
|
|
|
|
private static List<string>? _sort;
|
|
private static List<string>? _sort;
|
|
- public static List<string>? Sort { get => _sort; set => _sort = value; }
|
|
|
|
|
|
+ public static List<string>? Sort { get => _sort; set => _sort = value; }//ëèñò äëÿ ñîðòèðîâêè
|
|
|
|
+
|
|
|
|
|
|
- private decimal _priceOfAll;
|
|
|
|
- public decimal PriceOfAll
|
|
|
|
- {
|
|
|
|
- get => _priceOfAll;
|
|
|
|
- set => this.RaiseAndSetIfChanged(ref _priceOfAll, value);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- private bool _checkOrNot = false;
|
|
|
|
|
|
+ private bool _checkOrNot = false; //àêòóàëüíîñòü
|
|
public bool CheckOrNot
|
|
public bool CheckOrNot
|
|
{
|
|
{
|
|
get => _checkOrNot;
|
|
get => _checkOrNot;
|
|
@@ -36,7 +33,7 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private string? _findTour;
|
|
|
|
|
|
+ private string? _findTour; //ïîèñêîâàÿ ñòðîêà
|
|
public string? FindTour
|
|
public string? FindTour
|
|
{
|
|
{
|
|
get => _findTour;
|
|
get => _findTour;
|
|
@@ -47,7 +44,7 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private string? _selectedItem;
|
|
|
|
|
|
+ private string? _selectedItem; //âûáîðû òèïîâ ôèëüòðàöèÿ
|
|
public string? SelectedItem
|
|
public string? SelectedItem
|
|
{
|
|
{
|
|
get
|
|
get
|
|
@@ -61,7 +58,7 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private string? _selectedSort;
|
|
|
|
|
|
+ private string? _selectedSort;//ñîðòèðîâêà
|
|
public string? SelectedSort
|
|
public string? SelectedSort
|
|
{
|
|
{
|
|
get
|
|
get
|
|
@@ -75,7 +72,7 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public ToursViewModel()
|
|
|
|
|
|
+ public ToursViewModel()//êîíñòðóêòîð ñîðòèðîâêè
|
|
{
|
|
{
|
|
Tours = DB.Tours.ToList();
|
|
Tours = DB.Tours.ToList();
|
|
Types = DB.Types.Select(x=>x.Name).ToList();
|
|
Types = DB.Types.Select(x=>x.Name).ToList();
|
|
@@ -85,12 +82,12 @@ namespace UPtur.ViewModels
|
|
SelectedSort = Sort[0];
|
|
SelectedSort = Sort[0];
|
|
}
|
|
}
|
|
|
|
|
|
- public void Filter()
|
|
|
|
|
|
+ public void Filter()//ìåòîä äëÿ ôèëüòðà
|
|
{
|
|
{
|
|
Tours = DB.Tours.ToList();
|
|
Tours = DB.Tours.ToList();
|
|
- PriceOfAll = 0;
|
|
|
|
|
|
+
|
|
|
|
|
|
- if (SelectedItem != "Âñå")
|
|
|
|
|
|
+ if (SelectedItem != "Âñå")//ôèëòðàöèÿ ïî òèïó
|
|
{
|
|
{
|
|
List <TypeOfTour> TypesForFilter = DB.TypeOfTours.ToList();
|
|
List <TypeOfTour> TypesForFilter = DB.TypeOfTours.ToList();
|
|
List <int> IdForFilter = new List<int>();
|
|
List <int> IdForFilter = new List<int>();
|
|
@@ -146,17 +143,17 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(CheckOrNot)
|
|
|
|
|
|
+ if(CheckOrNot)//ïðîâåðêà íà àêòóàëüíûå òóðû
|
|
{
|
|
{
|
|
Tours = Tours.Where(x => x.IsActual[0]==true).ToList();
|
|
Tours = Tours.Where(x => x.IsActual[0]==true).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
- if(FindTour!=null && FindTour != "")
|
|
|
|
|
|
+ if(FindTour!=null && FindTour != "")//ïðîâåðêà ñòðîêè ïîèñêà íà çàïîëíåíîñòü
|
|
{
|
|
{
|
|
Tours = Tours.Where(x=>x.Name.ToUpper().Contains(FindTour.ToString().ToUpper()) || x.DescriptionWithoutNull.Contains(FindTour.ToString().ToUpper())).ToList();
|
|
Tours = Tours.Where(x=>x.Name.ToUpper().Contains(FindTour.ToString().ToUpper()) || x.DescriptionWithoutNull.Contains(FindTour.ToString().ToUpper())).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
- if(SelectedSort != "Áåç ñîðòèðîâêè")
|
|
|
|
|
|
+ if(SelectedSort != "Áåç ñîðòèðîâêè")//ïðîâåðêà íà íàëè÷èå ñîðòèðîâêè
|
|
{
|
|
{
|
|
switch(SelectedSort)
|
|
switch(SelectedSort)
|
|
{
|
|
{
|
|
@@ -169,10 +166,7 @@ namespace UPtur.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- foreach(Tour t in Tours)
|
|
|
|
- {
|
|
|
|
- PriceOfAll += (t.Price * t.TicketCount);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|