Leistungsverzeichnisposition kann nun bearbeitet werden
This commit is contained in:
84
KanSan.ViewModel/LeistungsverzeichnisPositionViewModel.cs
Normal file
84
KanSan.ViewModel/LeistungsverzeichnisPositionViewModel.cs
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user