diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs index 3f946b4..3d8c21f 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs @@ -285,7 +285,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF bool hasSignalR; Type type = typeof(T); - public RestCollection(string baseurl, string endpoint, string hub = null) + public RestCollection(string baseurl, string endpoint, string hub = null, bool nonCrud = false) { hasSignalR = hub != null; this.rest = new RestService(baseurl, endpoint); @@ -318,7 +318,21 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF this.notify.Init(); } - Init(); + + if (!nonCrud) + { + Init(); + } + else + { + InitCustomEndpoint(endpoint); + } + } + + private async Task InitCustomEndpoint(string endpoint) + { + items = await rest.GetAsync(endpoint); + CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } private async Task Init() diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetSubordinatesViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetSubordinatesViewModel.cs index fa38ef2..660998a 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetSubordinatesViewModel.cs +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetSubordinatesViewModel.cs @@ -42,7 +42,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels { if (!IsInDesignMode) { - Employees = new RestCollection("http://localhost:5000/", "api/GetSubordinates?id=" + e.ID.ToString(), "hub"); + Employees = new RestCollection("http://localhost:5000/", "api/GetSubordinates?id=" + e.ID.ToString(), "hub", true); UpdateEmployeeCommand = new RelayCommand(() => {