Ordner umstrukturierungen
This commit is contained in:
54
KanSan.ViewModel/Projekt/ProjektEditViewModel.cs
Normal file
54
KanSan.ViewModel/Projekt/ProjektEditViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
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 ProjektEditViewModel : PropertyChangedClass,INotifyPropertyChanged, IProjektEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private Projekt projekt;
|
||||
string projektnummer;
|
||||
string ort;
|
||||
public string Projektnummer
|
||||
{
|
||||
get => projektnummer;
|
||||
set
|
||||
{
|
||||
if (projektnummer != null && projektnummer == value) return;
|
||||
projektnummer = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string Ort
|
||||
{
|
||||
get => ort;
|
||||
set
|
||||
{
|
||||
if (ort != null && ort == value) return;
|
||||
ort = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ProjektEditViewModel(Projekt projekt)
|
||||
{
|
||||
this.projekt = projekt;
|
||||
projektnummer = projekt.Projektnummer;
|
||||
ort = projekt.Ort;
|
||||
}
|
||||
|
||||
public void Speichern()
|
||||
{
|
||||
projekt.Ort = Ort;
|
||||
projekt.Projektnummer = Projektnummer;
|
||||
unitOfWork.ProjekteRepository.Update(projekt);
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user