Imprägnierungen werden aufgelistet
Todo renavitor zur Imprägnierungsedit.
This commit is contained in:
28
DaSaSo.ViewModel/Commands/AddImpregnationCommand.cs
Normal file
28
DaSaSo.ViewModel/Commands/AddImpregnationCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Services;
|
||||
using DaSaSo.ViewModel.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.ViewModel.Commands
|
||||
{
|
||||
internal class AddImpregnationCommand : AsyncCommandBase
|
||||
{
|
||||
private IDataService<Impregnation> impregnationService;
|
||||
private IRenavigator editRenavigator;
|
||||
|
||||
public AddImpregnationCommand(IDataService<Impregnation> impregnationService, IRenavigator editRenavigator)
|
||||
{
|
||||
this.impregnationService = impregnationService;
|
||||
this.editRenavigator = editRenavigator;
|
||||
}
|
||||
|
||||
public override Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
DaSaSo.ViewModel/Commands/EditImpregnationCommand.cs
Normal file
33
DaSaSo.ViewModel/Commands/EditImpregnationCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Services;
|
||||
using DaSaSo.ViewModel.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.ViewModel.Commands
|
||||
{
|
||||
internal class EditImpregnationCommand : AsyncCommandBase
|
||||
{
|
||||
private IDataService<Impregnation> _impregnationService;
|
||||
private ImpregnierungListViewModel _impregnierungListViewModel;
|
||||
private IRenavigator _editRenavigator;
|
||||
|
||||
public EditImpregnationCommand(
|
||||
IDataService<Impregnation> impregnationService,
|
||||
ImpregnierungListViewModel impregnierungListViewModel,
|
||||
IRenavigator editRenavigator)
|
||||
{
|
||||
_impregnationService = impregnationService;
|
||||
_impregnierungListViewModel = impregnierungListViewModel;
|
||||
_editRenavigator = editRenavigator;
|
||||
}
|
||||
|
||||
public override Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DaSaSo.ViewModel/ImpregnierungEditViewModel.cs
Normal file
12
DaSaSo.ViewModel/ImpregnierungEditViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.ViewModel
|
||||
{
|
||||
public class ImpregnierungEditViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,37 @@
|
||||
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;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DaSaSo.ViewModel
|
||||
{
|
||||
public class ImpregnierungListViewModel : BaseViewModel
|
||||
{
|
||||
public ObservableCollection<Impregnation> Impregnations;
|
||||
public ObservableCollection<Impregnation> Impregnations { get; }
|
||||
private readonly IDataService<Impregnation> _impregnationService;
|
||||
private Impregnation? _selectedImpregnation = null;
|
||||
public Impregnation? SelectedImpregnation
|
||||
{
|
||||
get => _selectedImpregnation;
|
||||
set
|
||||
{
|
||||
if(_selectedImpregnation != value)
|
||||
{
|
||||
_selectedImpregnation = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
public ICommand EditImpregnationCommand { get; set; }
|
||||
public ICommand AddImpregnationCommand { get; set; }
|
||||
bool _isLoading;
|
||||
|
||||
public bool IsLoading {
|
||||
@@ -27,11 +46,24 @@ namespace DaSaSo.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public ImpregnierungListViewModel(IDataService<Impregnation> impregnationService)
|
||||
public ImpregnierungListViewModel(IDataService<Impregnation> impregnationService, IRenavigator editRenavigator)
|
||||
{
|
||||
IsLoading = true;
|
||||
Impregnations = new ObservableCollection<Impregnation>();
|
||||
_impregnationService = impregnationService;
|
||||
AddImpregnationCommand = new RelayCommand(() =>
|
||||
{
|
||||
Impregnation newImpregnation = new Impregnation()
|
||||
{
|
||||
Number = "Neu bitte Editieren!"
|
||||
};
|
||||
SelectedImpregnation = newImpregnation;
|
||||
Impregnations.Add(newImpregnation);
|
||||
OnPropertyChanged("Impregnations");
|
||||
});
|
||||
|
||||
//AddImpregnationCommand = //new AddImpregnationCommand(_impregnationService, editRenavigator);
|
||||
EditImpregnationCommand = new EditImpregnationCommand(_impregnationService, this, editRenavigator);
|
||||
LoadImpregnations();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user