[#57] DeliveryScheduleAdminWindow: Use Task.Run()

This commit is contained in:
2025-07-07 23:39:55 +02:00
parent 8aaa22fcb4
commit b6bfc60ab8
2 changed files with 14 additions and 12 deletions

View File

@ -152,7 +152,8 @@ namespace Elwig.Services {
public static async Task UpdateDeliverySchedule(this DeliveryScheduleAdminViewModel vm, int? oldYear, int? oldDsNr) {
int year = vm.Date!.Value.Year;
using (var ctx = new AppDbContext()) {
await Task.Run(async () => {
using var ctx = new AppDbContext();
var s = new DeliverySchedule {
Year = oldYear ?? year,
DsNr = oldDsNr ?? await ctx.NextDsNr(year),
@ -181,7 +182,7 @@ namespace Elwig.Services {
.ToList(), vm.MainVarieties.Select(v => (v, 1)).Union(vm.OtherVarieties.Select(v => (v, 2))).ToList());
await ctx.SaveChangesAsync();
}
});
App.HintContextChange();
}