コード例 #1
0
        public JsonErrorResult(string errorMessage = null, string redirect = null, bool allowGet = false)
        {
            Data = new JsonResultObject
            {
                success  = false,
                message  = errorMessage ?? string.Empty,
                redirect = redirect ?? string.Empty,
                data     = string.Empty,
            };

            if (allowGet)
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            }
        }
コード例 #2
0
        public JsonSuccessResult(object data = null, bool allowGet = false, string message = null, Enum status = null)
        {
            Data = new JsonResultObject
            {
                success  = true,
                data     = data ?? string.Empty,
                redirect = string.Empty,
                message  = message ?? string.Empty,
                status   = status == null ? "" : status.ToString(),
            };

            if (allowGet)
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            }
        }