55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
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 : BaseViewModel,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();
|
|
}
|
|
}
|
|
}
|