• bisController


        public class BisController : Controller
        {
            //
            // GET: /Bis/
    
    
            protected string GetJson(object obj)
            {
                IsoDateTimeConverter dtConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
                //http://www.cnblogs.com/litian/p/3870975.html
                return JsonConvert.SerializeObject(obj, dtConverter);
            }
    
            protected new JsonResult Json(object data)
            {
                return new HYJosnResult { Data = data };
            }
    
        }
        //http://www.cnblogs.com/chongsha/archive/2013/04/14/3019990.html
        public class HYJosnResult : JsonResult
        {
            public override void ExecuteResult(ControllerContext context)
            {
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }
                if ((this.JsonRequestBehavior == JsonRequestBehavior.DenyGet) && string.Equals(context.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
                {
                    throw new InvalidOperationException("");
                }
                HttpResponseBase response = context.HttpContext.Response;
                if (!string.IsNullOrEmpty(this.ContentType))
                {
                    response.ContentType = this.ContentType;
                }
                else
                {
                    response.ContentType = "application/json";
                }
                if (this.ContentEncoding != null)
                {
                    response.ContentEncoding = this.ContentEncoding;
                }
                if (this.Data != null)
                {
    
                    IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
                    timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                    response.Write(JsonConvert.SerializeObject(this.Data, Newtonsoft.Json.Formatting.Indented, timeFormat));
    
                }
            }
        }
  • 相关阅读:
    洛谷P1421 小玉买文具
    洛谷P1035 级数求和
    洛谷 P2337 【[SCOI2012]喵星人的入侵】
    洛谷P1002 过河卒
    洛谷 P4073 [WC2013]平面图
    洛谷 P4705 玩游戏
    python3.7-初学篇-06
    python3.7-初学篇-04
    python3.7-初学篇-03
    python3.7-初学篇-02
  • 原文地址:https://www.cnblogs.com/lzhp/p/4103141.html
Copyright © 2020-2023  润新知