Elight.WebUI/Controllers/BaseController.cs

(完整代码) 1KB

using Elight.Utility.Core;
using Elight.Utility.ResponseModels;
using Microsoft.AspNetCore.Mvc;

namespace Elight.WebUI.Controllers
{
    public class BaseController : Controller
    {
        #region 快捷方法
        protected ActionResult Success(string message = "恭喜您,操作成功。", object data = null)
        {
            return Content(new AjaxResult(ResultType.Success, message, data).ToJson());
        }
        protected ActionResult Error(string message = "对不起,操作失败。", object data = null)
        {
            return Content(new AjaxResult(ResultType.Error, message, data).ToJson());
        }
        protected ActionResult Warning(string message, object data = null)
        {
            return Content(new AjaxResult(ResultType.Warning, message, data).ToJson());
        }
        protected ActionResult Info(string message, object data = null)
        {
            return Content(new AjaxResult(ResultType.Info, message, data).ToJson());
        }
        #endregion
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。