[#10] ViewModels: Unify FilterMember property

This commit is contained in:
2024-07-05 21:21:33 +02:00
parent c314321039
commit 8dde1cb3f4
6 changed files with 22 additions and 12 deletions

View File

@ -12,7 +12,7 @@ namespace Elwig.Services {
public static async Task InitInputs(this AreaComAdminViewModel vm) {
using var ctx = new AppDbContext();
vm.FbNr = await ctx.NextFbNr();
vm.MgNr = vm.Member.MgNr;
vm.MgNr = vm.FilterMember.MgNr;
vm.YearFrom = Utils.CurrentYear;
vm.WineCult = null;
}
@ -36,7 +36,7 @@ namespace Elwig.Services {
public static async Task<(List<string>, IQueryable<AreaCom>, List<string>)> GetFilters(this AreaComAdminViewModel vm, AppDbContext ctx) {
List<string> filterNames = [];
IQueryable<AreaCom> areaComQuery = ctx.AreaCommitments.Where(a => a.MgNr == vm.Member.MgNr).OrderBy(a => a.FbNr);
IQueryable<AreaCom> areaComQuery = ctx.AreaCommitments.Where(a => a.MgNr == vm.FilterMember.MgNr).OrderBy(a => a.FbNr);
if (vm.ShowOnlyActiveAreaComs) {
areaComQuery = Utils.ActiveAreaCommitments(areaComQuery);
filterNames.Add("laufend");