public ActionResult Create(int PermitKey, PerformanceStandardCreateVM model) { if (!ModelState.IsValid) { // The dropdown values are lost when posting back PerformanceStandardNewRuleBO Screens = PerformanceStandardBLL.GetPerformanceStandardNewRule(model.Section); model.UpdateDropdownData(Screens); return PartialView(model); } try { PerformanceStandardRuleBO bo = model.GetDataObject(); bo.PerformanceStandardRule.PermitKey = PermitKey; PerformanceStandardBLL.SavePerformanceStandardRule(bo.PerformanceStandardRule); AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The rule was added"); result.Data.Add("Section", model.Section); return Json(result); } catch (Exception ex) { AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message); return Json(result); } }
/// <summary> /// Renders a form for creating a new Performance standard entry /// </summary> /// <param name="PermitKey"></param> /// <param name="Section"></param> /// <returns></returns> public ActionResult Create(int PermitKey, string Section) { PerformanceStandardNewRuleBO Screens = PerformanceStandardBLL.GetPerformanceStandardNewRule(Section); PerformanceStandardCreateVM model = new PerformanceStandardCreateVM(Screens, Section); return PartialView(model); }