fix
This commit is contained in:
@@ -20,12 +20,13 @@ public class ResponseFilter : IActionFilter
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext context)
|
||||
{
|
||||
var route = $"{context.Controller.GetType().Name}.{context.ActionDescriptor.DisplayName}";
|
||||
if (context.Result == null)
|
||||
throw new NotSupportedException($"Response required");
|
||||
throw new NotSupportedException($"[{route}] Response required");
|
||||
if (!(context.Result is ObjectResult result))
|
||||
throw new NotSupportedException($"Response must be an ObjectResult - {context.Result?.GetType().Name}");
|
||||
throw new NotSupportedException($"[{route}] Response must be an ObjectResult - {context.Result?.GetType().Name}");
|
||||
if (result.Value == null)
|
||||
throw new NotSupportedException($"Response must be an ObjectResult with value");
|
||||
throw new NotSupportedException($"[{route}] Response must be an ObjectResult with value");
|
||||
|
||||
if (result.Value is IResponseModel)
|
||||
{
|
||||
@@ -40,6 +41,6 @@ public class ResponseFilter : IActionFilter
|
||||
return;
|
||||
}
|
||||
|
||||
throw new NotSupportedException($"Response must be an ObjectResult with an IResponseModel - {result.Value?.GetType().Name}");
|
||||
throw new NotSupportedException($"[{route}] Response must be an ObjectResult with an IResponseModel - {result.Value?.GetType().Name}");
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MyOffice.Web.Models.Currency;
|
||||
using AutoMapper;
|
||||
using MyOffice.Services.Currency.Domain;
|
||||
|
||||
public class CurrencyGlobalViewModel
|
||||
public class CurrencyGlobalViewModel: IResponseModel
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using Services.Account.Domain;
|
||||
|
||||
public class ItemCategoryViewModel
|
||||
public class ItemCategoryViewModel: IResponseModel
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user