Ejemplo n.º 1
0
        protected void ReturnResult(HttpContext context, bool success, string msg, int code, bool isResponseEnd = true)
        {
            BaseResultViewModel baseResultViewModel = new BaseResultViewModel();

            baseResultViewModel.success = success;
            baseResultViewModel.message = msg;
            baseResultViewModel.code    = code;
            this.ReturnResult(context, baseResultViewModel, isResponseEnd);
        }
Ejemplo n.º 2
0
        protected void ReturnResult(HttpContext context, BaseResultViewModel result, bool isResponseEnd = true)
        {
            if (result == null)
            {
                result = new BaseResultViewModel
                {
                    success = false,
                    message = "错误信息为空",
                    code    = -1
                };
            }
            string s = JsonConvert.SerializeObject(result);

            context.Response.Write(s);
            if (isResponseEnd)
            {
                context.Response.End();
            }
        }