Esempio n. 1
0
 public ActionResult CreateRule()
 {
     var model = new HalRuleEditorModel();
     ViewBag.CurrentEventType = typeof(HalContext).AssemblyQualifiedNameWithoutVersion();
     ViewBag.Resources = _resourceDescriptorProvider.GetAllDescriptors();
     return View(model);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        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);
        }