diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml
index 3e009af..d84d3c8 100644
--- a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml
+++ b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml
@@ -21,66 +21,118 @@
-
-
+
+
-
+
+
+
+
-
+
-
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
-
+
-
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
-
+
-
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
-
+
-
+
+
+
+
+
+
diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml.cs
index 65c72d1..6bcccf7 100644
--- a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml.cs
+++ b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml.cs
@@ -23,12 +23,12 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
}
- private void ExpandAllClients(object sender, RoutedEventArgs e)
+ private void ExpandAllEmployees(object sender, RoutedEventArgs e)
{
}
- private void ExpandAllTeams(object sender, RoutedEventArgs e)
+ private void ExpandAllMaintainerTeams(object sender, RoutedEventArgs e)
{
}
diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs
index 9c08784..ca62261 100644
--- a/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs
+++ b/WD7UVN_SzTGUI_2023242.Client.WPF/RestCollection.cs
@@ -183,7 +183,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
public async Task DeleteAsync(int id, string endpoint)
{
HttpResponseMessage response =
- await client.DeleteAsync(endpoint + "/" + id.ToString());
+ await client.DeleteAsync("api/" + endpoint + "/" + id.ToString());
if (!response.IsSuccessStatusCode)
{
diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs
index e9a5644..5750f88 100644
--- a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs
+++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs
@@ -2,24 +2,48 @@
using System.ComponentModel;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
+using System.Windows.Input;
+using CommunityToolkit.Mvvm.Input;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
public class MainWindowViewModel : ObservableRecipient
{
- private string errorMessage;
-
- public string ErrorMessage
- {
- get { return errorMessage; }
- set { SetProperty(ref errorMessage, value); }
- }
-
public RestCollection Services { get; set; }
public RestCollection MaintainerTeams { get; set; }
public RestCollection Customers { get; set; }
public RestCollection Employees { get; set; }
+ private Service selectedService;
+ public Service SelectedService
+ {
+ get { return selectedService; }
+ set { SetProperty(ref selectedService, value); (DeleteServiceCommand as RelayCommand).NotifyCanExecuteChanged(); }
+ }
+ private Employee selectedEmployee;
+ public Employee SelectedEmployee
+ {
+ get { return selectedEmployee; }
+ set { SetProperty(ref selectedEmployee, value); (DeleteEmployeeCommand as RelayCommand).NotifyCanExecuteChanged(); }
+ }
+ private Customer selectedCustomer;
+ public Customer SelectedCustomer
+ {
+ get { return selectedCustomer; }
+ set { SetProperty(ref selectedCustomer, value); (DeleteCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); }
+ }
+ private MaintainerTeam selectedMaintainerTeam;
+ public MaintainerTeam SelectedMaintainerTeam
+ {
+ get { return selectedMaintainerTeam; }
+ set { SetProperty(ref selectedMaintainerTeam, value); (DeleteMaintainerTeamCommand as RelayCommand).NotifyCanExecuteChanged(); }
+ }
+
+ public ICommand DeleteServiceCommand { get; set; }
+ public ICommand DeleteCustomerCommand { get; set; }
+ public ICommand DeleteMaintainerTeamCommand { get; set; }
+ public ICommand DeleteEmployeeCommand { get; set; }
+
public static bool IsInDesignMode
{
get
@@ -33,10 +57,46 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
if (!IsInDesignMode)
{
- Services = new RestCollection("http://localhost:5000/", "api/Service");
- Employees = new RestCollection("http://localhost:5000/", "api/Employee");
- MaintainerTeams = new RestCollection("http://localhost:5000/", "api/MaintainerTeam");
- Customers = new RestCollection("http://localhost:5000/", "api/Customer");
+ Services = new RestCollection("http://localhost:5000/", "api/Service", "hub");
+ Employees = new RestCollection("http://localhost:5000/", "api/Employee", "hub");
+ MaintainerTeams = new RestCollection("http://localhost:5000/", "api/MaintainerTeam", "hub");
+ Customers = new RestCollection("http://localhost:5000/", "api/Customer", "hub");
+
+ DeleteServiceCommand = new RelayCommand(() =>
+ {
+ Services.Delete(SelectedService.ID);
+ },
+ () =>
+ {
+ return SelectedService != null;
+ });
+
+ DeleteCustomerCommand = new RelayCommand(() =>
+ {
+ Customers.Delete(SelectedCustomer.ID);
+ },
+ () =>
+ {
+ return SelectedCustomer != null;
+ });
+
+ DeleteEmployeeCommand = new RelayCommand(() =>
+ {
+ Employees.Delete(SelectedEmployee.ID);
+ },
+ () =>
+ {
+ return SelectedEmployee != null;
+ });
+
+ DeleteMaintainerTeamCommand = new RelayCommand(() =>
+ {
+ MaintainerTeams.Delete(SelectedMaintainerTeam.ID);
+ },
+ () =>
+ {
+ return SelectedMaintainerTeam != null;
+ });
}
}
}
diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user b/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user
index d04fb40..c2dcba3 100644
--- a/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user
+++ b/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user
@@ -7,12 +7,54 @@
-
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
Code
-
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
Designer