noncrud db calls now work
This commit is contained in:
@@ -285,7 +285,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
|
|||||||
bool hasSignalR;
|
bool hasSignalR;
|
||||||
Type type = typeof(T);
|
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;
|
hasSignalR = hub != null;
|
||||||
this.rest = new RestService(baseurl, endpoint);
|
this.rest = new RestService(baseurl, endpoint);
|
||||||
@@ -318,7 +318,21 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
|
|||||||
|
|
||||||
this.notify.Init();
|
this.notify.Init();
|
||||||
}
|
}
|
||||||
Init();
|
|
||||||
|
if (!nonCrud)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InitCustomEndpoint(endpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task InitCustomEndpoint(string endpoint)
|
||||||
|
{
|
||||||
|
items = await rest.GetAsync<T>(endpoint);
|
||||||
|
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
if (!IsInDesignMode)
|
if (!IsInDesignMode)
|
||||||
{
|
{
|
||||||
Employees = new RestCollection<Employee>("http://localhost:5000/", "api/GetSubordinates?id=" + e.ID.ToString(), "hub");
|
Employees = new RestCollection<Employee>("http://localhost:5000/", "api/GetSubordinates?id=" + e.ID.ToString(), "hub", true);
|
||||||
|
|
||||||
UpdateEmployeeCommand = new RelayCommand(() =>
|
UpdateEmployeeCommand = new RelayCommand(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user