示例#1
0
        public async Task<IActionResult> PointRule(MemberPointRule pointRule)
        {
            if (ModelState.IsValid)
            {
                //MemberPointRule pointRule = null;
               if (pointRule.Level0 == null && Request.Form.Count > 0) {
                    string v = Request.Form["pointRule"];
                    pointRule = MemberPointRule.fromJson(v);
                }

                if (pointRule == null) {
                    return ErrorMessage.BadRequestJsonResult("Cannot parse request context.");
                }

                //MemberPointRule r = JsonConvert.<MemberPointRule>()
                // string bodyStr = GetFromBodyString(Request);
                //MemberPointRule pointRule = MemberPointRule.fromJson(pointRuleValue);
                await AddOrUpdateSetting(SettingName.PointRule.ToString(), "json", pointRule.toJson());
                return Json("OK");
            }
            return ErrorMessage.BadRequestJsonResult(ModelState.Values.SelectMany(x => x.Errors));
        }