Ausgewählte Leistung wird in tätigkeit dargestellt

This commit is contained in:
Husky
2020-04-19 16:29:30 +02:00
parent 91c4344c72
commit 1308d35eab
5 changed files with 50 additions and 10 deletions

View File

@@ -4,27 +4,44 @@ using KanSan.Base.Interfaces.UI;
using KanSan.Base.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace KanSan.ViewModel
{
public class LeistungsverzeichnisPositionenListViewModel : ILeistungsverzeichnisPositionListViewModel
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
{
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
List<LeistungsverzeichnisPosition> lvPositionen;
public List<LeistungsverzeichnisPosition> LVPositionen => lvPositionen;
public List<LeistungsverzeichnisPosition> LVPositionen
{
get => lvPositionen;
set
{
if (lvPositionen == value) return;
lvPositionen = value;
OnPropertyChanged();
}
}
string tag;
public LeistungsverzeichnisPositionenListViewModel(string tag)
{
if(tag == string.Empty)
this.tag = tag;
LoadLVPositionen();
}
void LoadLVPositionen()
{
if (tag == string.Empty)
{
lvPositionen = unitOfWork.LeistungsverzeichnisRepository.Get().ToList();
}
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get().ToList();
}
else
{
lvPositionen = unitOfWork.LeistungsverzeichnisRepository.Get(x => x.Tag.Equals(tag)).ToList();
if (lvPositionen == null) lvPositionen = new List<LeistungsverzeichnisPosition>();
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get(x => x.Tag.Equals(tag)).ToList();
if (LVPositionen == null) LVPositionen = new List<LeistungsverzeichnisPosition>();
}
}
@@ -41,6 +58,7 @@ namespace KanSan.ViewModel
};
unitOfWork.LeistungsverzeichnisRepository.Insert(leistungsverzeichnisPosition);
unitOfWork.Commit();
LoadLVPositionen();
return leistungsverzeichnisPosition;
}