public JsonResult CreateRule(int roleId, RegistrationRuleRecordViewModel model) { var roleCollection = this.validateRuleService.GetRoleRuleCollection(roleId); var createdModel = this.validateRuleService.AddRule(model.CheckUserOnRegistration, model.RuleName, model.Operator, model.RuleAction, model.InculusionRule, roleCollection); return Json(createdModel.Id, JsonRequestBehavior.DenyGet); }
public JsonResult DestroyRule(int roleId, RegistrationRuleRecordViewModel model) { var roleCollection = this.validateRuleService.GetRoleRuleCollection(roleId); var updateModel = roleCollection.Rules.FirstOrDefault(e => e.Id == model.Id); if (updateModel == null) return Json(false); this.validateRuleService.RemoveRule(updateModel); return Json(true); }
public JsonResult UpdateRule(int roleId, RegistrationRuleRecordViewModel model) { var roleCollection = this.validateRuleService.GetRoleRuleCollection(roleId); var updateModel = roleCollection.Rules.FirstOrDefault(e => e.Id == model.Id); updateModel.Operator = model.Operator; updateModel.RuleAction = model.RuleAction; updateModel.RuleName = model.RuleName; updateModel.CheckUserOnRegistration = model.CheckUserOnRegistration; updateModel.InculusionRule = model.InculusionRule; this.validateRuleService.UpdateRule(updateModel); return Json(true, JsonRequestBehavior.DenyGet); }