Skip to content

Commit

Permalink
Use CreateModelMaybeAsync.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Jul 14, 2024
1 parent 616a1ce commit 69087bd
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ await AuthorizeAsync()

public override async Task<IDisplayResult> UpdateAsync(TSection section, UpdateEditorContext context)
{
var viewModel = new JsonViewModel<TAdditionalData>();

if (context.GroupId == GroupId &&
await AuthorizeAsync() &&
await context.Updater.TryUpdateModelAsync(viewModel, Prefix) &&
if (await context.CreateModelMaybeAsync<JsonViewModel<TAdditionalData>>(Prefix, GroupId, AuthorizeAsync) is { } viewModel &&
TryParseJson(viewModel.Json, out var result))
{
await UpdateAsync(section, context, result);
Expand Down

0 comments on commit 69087bd

Please sign in to comment.