BaseDataWindow: Fix season modifier crash

This commit is contained in:
2024-03-30 08:39:57 +01:00
parent eddea88e77
commit 1419c834ac
2 changed files with 3 additions and 2 deletions

View File

@ -13,12 +13,12 @@ namespace Elwig.Windows {
private bool _seasonUpdate = false; private bool _seasonUpdate = false;
private async Task SeasonsInitEditing(AppDbContext ctx) { private async Task SeasonsInitEditing(AppDbContext ctx) {
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.OrderByDescending(s => s.Year).ToListAsync()); ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.Include(s => s.Modifiers).OrderByDescending(s => s.Year).ToListAsync());
SeasonList_SelectionChanged(null, null); SeasonList_SelectionChanged(null, null);
} }
private async Task SeasonsFinishEditing(AppDbContext ctx) { private async Task SeasonsFinishEditing(AppDbContext ctx) {
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.OrderByDescending(s => s.Year).Include(s => s.Modifiers).ToListAsync()); ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.Include(s => s.Modifiers).OrderByDescending(s => s.Year).ToListAsync());
_seasonChanged = false; _seasonChanged = false;
} }

View File

@ -142,6 +142,7 @@ namespace Elwig.Windows {
FillInputs(App.Client); FillInputs(App.Client);
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
.OrderByDescending(s => s.Year) .OrderByDescending(s => s.Year)
.Include(s => s.Modifiers)
.ToListAsync(), null, ControlUtils.RenewSourceDefault.First); .ToListAsync(), null, ControlUtils.RenewSourceDefault.First);
var year = (SeasonList.SelectedItem as Season)?.Year; var year = (SeasonList.SelectedItem as Season)?.Year;
ControlUtils.RenewItemsSource(BranchList, await ctx.Branches ControlUtils.RenewItemsSource(BranchList, await ctx.Branches