This commit is contained in:
Bjarke Berg
2020-05-26 13:08:20 +02:00
parent 2c2d70c500
commit e879c5c7d9
6 changed files with 213 additions and 169 deletions

View File

@@ -4,6 +4,7 @@ using System.Net;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Common.Exceptions
{
@@ -68,5 +69,16 @@ namespace Umbraco.Web.Common.Exceptions
}
};
}
public static HttpResponseException CreateNotificationValidationErrorResponse(string errorMessage)
{
var notificationModel = new SimpleNotificationModel
{
Message = errorMessage
};
notificationModel.AddErrorNotification(errorMessage, string.Empty);
return CreateValidationErrorResponse(notificationModel);
}
}
}