Surrounding ModelState with the newly introduced SimpleValidationModel type

This commit is contained in:
Elitsa Marinovska
2021-01-13 11:39:44 +01:00
parent 2e62a6c5f2
commit b572cf6809
7 changed files with 18 additions and 13 deletions

View File

@@ -10,9 +10,11 @@ using Microsoft.Net.Http.Headers;
using Semver;
using Umbraco.Core;
using Umbraco.Core.Hosting;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Packaging;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Extensions;
using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Authorization;
@@ -67,7 +69,7 @@ namespace Umbraco.Web.BackOffice.Controllers
public ActionResult<PackageDefinition> PostSavePackage(PackageDefinition model)
{
if (ModelState.IsValid == false)
return new ValidationErrorResult(ModelState);
return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary()));
//save it
if (!_packagingService.SaveCreatedPackage(model))