From 69087bdca3ba2ac95ab1b08af226bc93439ff387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 14 Jul 2024 11:50:24 +0200 Subject: [PATCH] Use CreateModelMaybeAsync. --- .../Contents/JsonSectionDisplayDriver.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs index 1e81d4c1..3169a880 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/JsonSectionDisplayDriver.cs @@ -45,11 +45,7 @@ await AuthorizeAsync() public override async Task UpdateAsync(TSection section, UpdateEditorContext context) { - var viewModel = new JsonViewModel(); - - if (context.GroupId == GroupId && - await AuthorizeAsync() && - await context.Updater.TryUpdateModelAsync(viewModel, Prefix) && + if (await context.CreateModelMaybeAsync>(Prefix, GroupId, AuthorizeAsync) is { } viewModel && TryParseJson(viewModel.Json, out var result)) { await UpdateAsync(section, context, result);