Add LINQ Query

Prepare Api for Queryable Lists instead of Dictionarys
This commit is contained in:
2024-09-07 19:40:58 +02:00
parent 6c4cf48776
commit ce61d0c55d
5 changed files with 35 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ using Microsoft.Maui.Networking;
using ZXing.Net.Maui;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Jugenddienst_Stunden.Models;
namespace Jugenddienst_Stunden.ViewModels {
@@ -37,8 +38,12 @@ namespace Jugenddienst_Stunden.ViewModels {
get => _hour.overtime_month;
}
public Dictionary<int, decimal> ZeitTotalDaily {
get => _hour.zeit_total_daily;
//public Dictionary<int, decimal> ZeitTotalDaily {
// get => _hour.zeit_total_daily;
//}
public List<Models.TimeDay> ZeitTotalDaily {
get => _hour.zeit_total_daily_api;
}
public string Title { get; set; } = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
@@ -46,6 +51,8 @@ namespace Jugenddienst_Stunden.ViewModels {
public ObservableCollection<string> Options { get; }
public ObservableCollection<string> OptionsProjekt { get; }
public ObservableCollection<string> OptionsFreistellung { get; }
public List<TimeDay> TimeDay { get; set; }
private string selectedOption;
public string SelectedOption {
get => selectedOption;
@@ -79,7 +86,7 @@ namespace Jugenddienst_Stunden.ViewModels {
};
_hour = new Models.Hours();
LoadDataCommand = new AsyncRelayCommand(LoadData);
}
//protected void OnPropertyChanged(string propertyName) {
@@ -100,6 +107,7 @@ namespace Jugenddienst_Stunden.ViewModels {
//Models.Hours Hours = new Models.Hours();
//Title = _hour.operator_api.name + " " + _hour.operator_api.surname;
if (_hour != null) {
TimeDay = _hour.zeit_total_daily_api.Where(p => p.Day == 1).ToList();
RefreshProperties();
}
}
@@ -113,6 +121,7 @@ namespace Jugenddienst_Stunden.ViewModels {
OnPropertyChanged(nameof(Hours));
OnPropertyChanged(nameof(Title));
OnPropertyChanged(nameof(ZeitTotalDaily));
OnPropertyChanged(nameof(TimeDay));
}