Client wird gespeichert mittels interface
This commit is contained in:
33
DaSaSo.ViewModel/Commands/SelectClientCommand.cs
Normal file
33
DaSaSo.ViewModel/Commands/SelectClientCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using DaSaSo.ViewModel.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DaSaSo.ViewModel.Commands
|
||||
{
|
||||
public class SelectClientCommand : ICommand
|
||||
{
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
private readonly IActualProject _actualProject;
|
||||
private readonly ClientListViewModel _clientListViewModel;
|
||||
public SelectClientCommand(IActualProject actualProject, ClientListViewModel clientListViewModel)
|
||||
{
|
||||
_actualProject = actualProject;
|
||||
_clientListViewModel = clientListViewModel;
|
||||
}
|
||||
|
||||
public bool CanExecute(object? parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object? parameter)
|
||||
{
|
||||
var s = _clientListViewModel.SelectedClient;
|
||||
_actualProject.SetClient(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user