BaseDataWindow: Fix data renewal

This commit is contained in:
2024-03-30 08:49:11 +01:00
parent 1419c834ac
commit 1047bc6e8f
5 changed files with 33 additions and 9 deletions

View File

@ -19,7 +19,9 @@ namespace Elwig.Windows {
private bool _attrUpdate = false;
private async Task WineAttributesInitEditing(AppDbContext ctx) {
_attrList = new(await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
_attrList = new(await ctx.WineAttributes
.OrderBy(a => a.Name)
.ToListAsync());
_attrs = _attrList.ToDictionary(a => a.AttrId, a => (string?)a.AttrId);
_attrIds = _attrList.ToDictionary(a => a, a => a.AttrId);
ControlUtils.RenewItemsSource(WineAttributeList, _attrList);
@ -27,7 +29,9 @@ namespace Elwig.Windows {
}
private async Task WineAttributesFinishEditing(AppDbContext ctx) {
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes
.OrderBy(a => a.Name)
.ToListAsync());
_attrList = null;
_attrs = null;
_attrIds = null;