GetAll windows done
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using WD7UVN_HFT_2023241.Models;
|
||||
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 GetAllCustomersViewModel : ObservableRecipient
|
||||
{
|
||||
public RestCollection<Customer> Customers { get; set; }
|
||||
|
||||
private Customer selectedCustomer;
|
||||
|
||||
public Customer SelectedCustomer
|
||||
{
|
||||
get { return selectedCustomer; }
|
||||
set { SetProperty(ref selectedCustomer, value); (UpdateCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); }
|
||||
}
|
||||
|
||||
public ICommand UpdateCustomerCommand { get; set; }
|
||||
|
||||
public static bool IsInDesignMode
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = DesignerProperties.IsInDesignModeProperty;
|
||||
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public GetAllCustomersViewModel()
|
||||
{
|
||||
if (!IsInDesignMode)
|
||||
{
|
||||
Customers = new RestCollection<Customer>("http://localhost:5000/", "api/Customer", "hub");
|
||||
|
||||
UpdateCustomerCommand = new RelayCommand(() =>
|
||||
{
|
||||
Customers.Update(SelectedCustomer);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return SelectedCustomer != null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using WD7UVN_HFT_2023241.Models;
|
||||
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 GetAllEmployeesViewModel : ObservableRecipient
|
||||
{
|
||||
public RestCollection<Employee> Employees { get; set; }
|
||||
|
||||
private Employee selectedEmployee;
|
||||
|
||||
public Employee SelectedEmployee
|
||||
{
|
||||
get { return selectedEmployee; }
|
||||
set { SetProperty(ref selectedEmployee, value); (UpdateEmployeeCommand as RelayCommand).NotifyCanExecuteChanged(); }
|
||||
}
|
||||
|
||||
public ICommand UpdateEmployeeCommand { get; set; }
|
||||
|
||||
public static bool IsInDesignMode
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = DesignerProperties.IsInDesignModeProperty;
|
||||
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public GetAllEmployeesViewModel()
|
||||
{
|
||||
if (!IsInDesignMode)
|
||||
{
|
||||
Employees = new RestCollection<Employee>("http://localhost:5000/", "api/Employee", "hub");
|
||||
|
||||
UpdateEmployeeCommand = new RelayCommand(() =>
|
||||
{
|
||||
Employees.Update(SelectedEmployee);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return SelectedEmployee != null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using WD7UVN_HFT_2023241.Models;
|
||||
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 GetAllMaintainerTeamsViewModel : ObservableRecipient
|
||||
{
|
||||
public RestCollection<MaintainerTeam> MaintainerTeams { get; set; }
|
||||
|
||||
private MaintainerTeam selectedMaintainerTeam;
|
||||
|
||||
public MaintainerTeam SelectedMaintainerTeam
|
||||
{
|
||||
get { return selectedMaintainerTeam; }
|
||||
set { SetProperty(ref selectedMaintainerTeam, value); (UpdateMaintainerTeamCommand as RelayCommand).NotifyCanExecuteChanged(); }
|
||||
}
|
||||
|
||||
public ICommand UpdateMaintainerTeamCommand { get; set; }
|
||||
|
||||
public static bool IsInDesignMode
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = DesignerProperties.IsInDesignModeProperty;
|
||||
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public GetAllMaintainerTeamsViewModel()
|
||||
{
|
||||
if (!IsInDesignMode)
|
||||
{
|
||||
MaintainerTeams = new RestCollection<MaintainerTeam>("http://localhost:5000/", "api/MaintainerTeam", "hub");
|
||||
|
||||
UpdateMaintainerTeamCommand = new RelayCommand(() =>
|
||||
{
|
||||
MaintainerTeams.Update(SelectedMaintainerTeam);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return SelectedMaintainerTeam != null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user