using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PMS.WebUI
{
///
/// 返回json格式的内容
///
public class JsonContent : ActionResult
{
///
/// 输出200表示成功,否则表示失败
///
public int code { get; set; }
///
/// 输出结果消息
///
public string message { get; set; }
public JsonContent(bool result, string message)
{
this.code = result ? 200 : -1;
this.message = message;
}
///
/// 转为json
///
///
public override string ToString()
{
return QWPlatform.SystemLibrary.Utils.Strings.ObjectToJson(this);
}
///
/// 输出结果
///
///
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ContentType = "text/json";
context.HttpContext.Response.Write(this.ToString());
}
}
}