WhoUsesService done
This commit is contained in:
@@ -24,6 +24,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
|
||||
(DeleteServiceCommand as RelayCommand).NotifyCanExecuteChanged();
|
||||
(GetResponsibleEmployeeCommand as RelayCommand).NotifyCanExecuteChanged();
|
||||
(GetMaintainersCommand as RelayCommand).NotifyCanExecuteChanged();
|
||||
(GetUserCommand as RelayCommand).NotifyCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +32,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
|
||||
public ICommand DeleteServiceCommand { get; set; }
|
||||
public ICommand GetResponsibleEmployeeCommand { get; set; }
|
||||
public ICommand GetMaintainersCommand { get; set; }
|
||||
public ICommand GetUserCommand { get; set; }
|
||||
|
||||
public static bool IsInDesignMode
|
||||
{
|
||||
@@ -84,6 +86,16 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
|
||||
{
|
||||
return SelectedService != null;
|
||||
});
|
||||
|
||||
GetUserCommand = new RelayCommand(() =>
|
||||
{
|
||||
Window window = new GetUsers(SelectedService);
|
||||
window.Show();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return SelectedService != null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using WD7UVN_HFT_2023241.Models;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
|
||||
{
|
||||
public class GetUsersViewModel : ObservableRecipient
|
||||
{
|
||||
public RestCollection<Customer> Clients { get; set; }
|
||||
|
||||
public static bool IsInDesignMode
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = DesignerProperties.IsInDesignModeProperty;
|
||||
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public GetUsersViewModel(Service e)
|
||||
{
|
||||
if (!IsInDesignMode)
|
||||
{
|
||||
Clients = new RestCollection<Customer>("http://localhost:5000/", "api/WhoUsesService?id=" + e.ID.ToString(), "hub", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user