Leistungsverzeichnisposition kann nun bearbeitet werden

This commit is contained in:
Husky
2020-04-18 18:00:33 +02:00
parent afc68f5a7f
commit 8d12594067
7 changed files with 161 additions and 9 deletions

View File

@@ -0,0 +1,84 @@
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 LeistungsverzeichnisPositionViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
{
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
LeistungsverzeichnisPosition model;
string positionsnummer;
string beschreibung;
string einheit;
string tag;
public string Positionsnummer
{
get => positionsnummer;
set
{
if (positionsnummer == value) return;
positionsnummer = value;
OnPropertyChanged();
}
}
public string Beschreibung
{
get => beschreibung;
set
{
if (beschreibung == value) return;
beschreibung = value;
OnPropertyChanged();
}
}
public string Einheit
{
get => einheit;
set
{
if (einheit == value) return;
einheit = value;
OnPropertyChanged();
}
}
public string Tag
{
get => tag;
set
{
if (tag == value) return;
tag = value;
OnPropertyChanged();
}
}
public LeistungsverzeichnisPositionViewModel(LeistungsverzeichnisPosition position)
{
this.model = position;
positionsnummer = model.Positionsnummer;
beschreibung = model.Beschreibung;
einheit = model.Einheit;
tag = model.Tag;
}
public void Speichern()
{
model.Positionsnummer = positionsnummer;
model.Beschreibung = beschreibung;
model.Einheit = einheit;
model.Tag = tag;
unitOfWork.LeistungsverzeichnisRepository.Update(model);
unitOfWork.Commit();
}
}
}