using Learun.Util;
using System.Web.Mvc;
namespace Learun.Application.Website
{
///
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创建人:力软-框架开发组
/// 日 期:2017.03.08
/// 描 述:基础控制器
///
public abstract class MvcControllerBase : Controller
{
#region 请求响应
///
/// 返回成功消息
///
/// 数据
///
protected virtual ActionResult ToJsonResult(object data)
{
return Content(data.ToJson());
}
///
/// 返回成功消息
///
/// 消息
///
protected virtual ActionResult Success(string info)
{
return Content(new ResParameter { code = ResponseCode.success, info = info, data = new object { } }.ToJson());
}
///
/// 返回成功消息
///
/// 数据
///
protected virtual ActionResult SuccessString(string data)
{
return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
}
///
/// 返回成功数据
///
/// 数据
///
protected virtual ActionResult Success(object data)
{
return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
}
///
/// 返回成功消息
///
/// 消息
/// 数据
///
protected virtual ActionResult Success(string info, object data)
{
return Content(new ResParameter { code = ResponseCode.success, info = info, data = data }.ToJson());
}
///
/// 返回失败消息
///
/// 消息
///
protected virtual ActionResult Fail(string info)
{
return Content(new ResParameter { code = ResponseCode.fail, info = info }.ToJson());
}
///
/// 返回失败消息
///
/// 消息
/// 消息
///
protected virtual ActionResult Fail(string info, object data)
{
return Content(new ResParameter { code = ResponseCode.fail, info = info, data = data }.ToJson());
}
#endregion
}
}