public ActionResult CreateRule() { var model = new HalRuleEditorModel(); ViewBag.CurrentEventType = typeof(HalContext).AssemblyQualifiedNameWithoutVersion(); ViewBag.Resources = _resourceDescriptorProvider.GetAllDescriptors(); return View(model); }
public ActionResult EditRule(int id) { var rule = _halRuleService.GetById(id); var model = new HalRuleEditorModel(rule); ViewBag.CurrentEventType = typeof(HalContext).AssemblyQualifiedNameWithoutVersion(); ViewBag.Resources = _resourceDescriptorProvider.GetAllDescriptors(); return View(model); }
public ActionResult SaveRule(HalRuleEditorModel model, string @return) { var resources = Request.Form["Resources"].Split(','); foreach(var res in resources) { model.Resources.Add(new HalRuleResourceModel() { RuleId = model.Id, ResourceName = res }); } HalRule rule = new HalRule(); model.UpdateTo(rule); _halRuleService.Save(rule); return AjaxForm().Success().RedirectTo(@return); }