Baustellen können nun angelegt und ausgewählt werden
This commit is contained in:
55
KanSan.ViewModel/Baustelle/BaustelleEditViewModel.cs
Normal file
55
KanSan.ViewModel/Baustelle/BaustelleEditViewModel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using KanSan.Base;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaustelleEditViewModel : PropertyChangedClass, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private Baustelle baustelle;
|
||||
string ortTeil;
|
||||
string baustelleNummer;
|
||||
|
||||
public string OrtTeil
|
||||
{
|
||||
get => ortTeil;
|
||||
set
|
||||
{
|
||||
if (ortTeil != null && ortTeil == value) return;
|
||||
ortTeil = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string BaustelleNummer
|
||||
{
|
||||
get => baustelleNummer;
|
||||
set
|
||||
{
|
||||
if (baustelleNummer != null && baustelleNummer == value) return;
|
||||
baustelleNummer = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public BaustelleEditViewModel(Baustelle baustelle)
|
||||
{
|
||||
this.baustelle = baustelle;
|
||||
baustelleNummer = baustelle.BaustelleNummer;
|
||||
ortTeil = baustelle.OrtTeil;
|
||||
}
|
||||
|
||||
public void Speichern()
|
||||
{
|
||||
baustelle.OrtTeil = OrtTeil;
|
||||
baustelle.BaustelleNummer = BaustelleNummer;
|
||||
unitOfWork.BaustelleRepository.Update(baustelle);
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user