Replacing HttpResponseException in Attributes

This commit is contained in:
Elitsa Marinovska
2021-01-13 10:59:27 +01:00
parent d6e90c7e7e
commit 2c81d09d0e
2 changed files with 5 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Net;
using Microsoft.AspNetCore.Mvc;
@@ -10,7 +10,6 @@ using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Extensions;
using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.BackOffice.Filters
@@ -106,7 +105,7 @@ namespace Umbraco.Web.BackOffice.Filters
if (context.ModelState.IsValid == false)
{
// if it is not valid, do not continue and return the model state
throw HttpResponseException.CreateValidationErrorResponse(context.ModelState);
context.Result = new ValidationErrorResult(context.ModelState);
}
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
@@ -7,7 +7,7 @@ using Umbraco.Core.Mapping;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Web.BackOffice.ActionResults;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.BackOffice.Filters
@@ -86,7 +86,7 @@ namespace Umbraco.Web.BackOffice.Filters
if (context.ModelState.IsValid == false)
{
//if it is not valid, do not continue and return the model state
throw HttpResponseException.CreateValidationErrorResponse(context.ModelState);
context.Result = new ValidationErrorResult(context.ModelState);
}
}