Client wird gespeichert mittels interface

This commit is contained in:
HuskyTeufel
2021-09-14 19:08:55 +02:00
parent 8eccf7c478
commit bbffb270bc
13 changed files with 149 additions and 70 deletions

View File

@@ -1,5 +1,7 @@
using DaSaSo.Domain.Model;
using DaSaSo.Domain.Services;
using DaSaSo.ViewModel.Commands;
using DaSaSo.ViewModel.Interface;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
@@ -20,7 +22,7 @@ namespace DaSaSo.ViewModel
IEnumerable<Client>? result;
bool _isLoading = true;
public IRelayCommand SelectClientCommand { get; set; }
public ICommand SelectCommand { get; set; }
public IRelayCommand EditClientCommand { get; set; }
public IRelayCommand AddNewClientCommand { get; set; }
@@ -32,8 +34,8 @@ namespace DaSaSo.ViewModel
if(_selectedClient != value)
{
_selectedClient = value;
SelectClientCommand.NotifyCanExecuteChanged();
EditClientCommand.NotifyCanExecuteChanged();
//SelectClientCommand.NotifyCanExecuteChanged();
//EditClientCommand.NotifyCanExecuteChanged();
OnPropertyChanged();
}
}
@@ -52,16 +54,16 @@ namespace DaSaSo.ViewModel
}
}
public ClientListViewModel(IDataService<Client> dataService)
public ClientListViewModel(IDataService<Client> dataService, IActualProject actualProject)
{
Clients = new ObservableCollection<Client>();
_dataService = dataService;
LoadClient();
SelectClientCommand = new RelayCommand(SelectClient, () => SelectedClient != null);
EditClientCommand = new RelayCommand(EditClient, () => SelectedClient != null);
AddNewClientCommand = new RelayCommand(AddNewClient);
SelectCommand = new SelectClientCommand(actualProject,this); //= new RelayCommand(SelectClient, () => SelectedClient != null);
//EditClientCommand = new RelayCommand(EditClient, () => SelectedClient != null);
//AddNewClientCommand = new RelayCommand(AddNewClient);
}
@@ -93,6 +95,7 @@ namespace DaSaSo.ViewModel
private void SelectClient()
{
Mediator.Notify(Enums.EMediator.SELECTEDCLIENT, SelectedClient);
}