Einfugen neuer

This commit is contained in:
2025-06-02 17:16:38 +02:00
parent 99640602f5
commit 8813c83ed9
7 changed files with 96 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
using System.Windows;
using System.Windows.Input;
namespace FahzeugWPF;
class EinfuegenModel : ViewModelBase
{
private readonly FahrzeugeModell _fahrzeugeModell;
public EinfuegenModel(FahrzeugeModell model)
{
this._fahrzeugeModell = model;
EinfuegenKommando = new RelayCommand(Einfugen);
}
public string NeuesrFahrzeugName { get; set; }
public string NeuerFahrzeugTyp { get; set; }
public ICommand EinfuegenKommando { get; private set; }
private void Einfugen(object? o)
{
if (string.IsNullOrEmpty(NeuerFahrzeugTyp) || string.IsNullOrEmpty(NeuesrFahrzeugName)) { return; }
_fahrzeugeModell.EinfuegenFahrzeug(NeuesrFahrzeugName, NeuerFahrzeugTyp);
if (o is Window window)
{
window.Close();
}
}
}