BaseController.cs 753 Bytes
using HHECS.Infrastructure.Json;
using HHECS.Infrastructure.LogHelper;
using HHECS.Model.ViewEntity;
using Microsoft.AspNetCore.Mvc;
using MySqlX.XDevAPI.Common;
using System.Reflection;
using System;
using Ubiety.Dns.Core;
using NPOI.SS.Formula.Functions;

namespace HHECS.WebAPI.Controllers
{
    public class BaseController : ControllerBase
    {
        public string Serialize(Func<dynamic> action, string methodName = "")
        {
            var result = ExceptionsHelp.Instance.ExecuteT(action, methodName, actionCatCh: (error) =>
            {
                var response = new ResponseNew();
                return response.ResponseError(error);
            });
            return JsonHelper.Instance.Serialize(result);
        }
    }
}