using learun.util;
using Microsoft.AspNetCore.Mvc;
namespace learun.website
{
///
/// 版 本 Learun-ADMS-Core 力软管理后台
/// Copyright (c) 2019-present 力软信息技术(苏州)有限公司
/// 创建人:tobin
/// 日 期:2019.09.11
/// 描 述:基础控制器
///
public class MvcControllerBase : Controller
{
#region 请求响应
///
/// 返回成功数据
///
/// 数据
///
protected virtual IActionResult Success(object data)
{
return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
}
///
/// 返回成功消息
///
/// 信息
/// 数据
///
protected virtual IActionResult Success(string info, object data)
{
return Content(new ResParameter { code = ResponseCode.success, info = info, data = data }.ToJson());
}
///
/// 返回成功数据
///
/// 信息
///
protected virtual IActionResult SuccessInfo(string info)
{
return Content(new ResParameter { code = ResponseCode.success, info = info }.ToJson());
}
///
/// 返回失败消息
///
/// 消息
///
protected virtual IActionResult Fail(string info)
{
return Content(new ResParameter { code = ResponseCode.fail, info = info }.ToJson());
}
#endregion
}
}