public ActionResult Create(OrgUnit ou) { var jr = new JsonResult { Data = new JsTreeNode(ou.Create()) }; return jr; }
public ActionResult Delete(OrgUnit ou) { if (ou.Delete()) { Response.StatusCode = (int)HttpStatusCode.OK; return new EmptyResult(); } // TODO: this should return JsonError somehow... return new ViewResult() { ViewName = "Error" }; }
public ActionResult Update(OrgUnit ou) { if (ou.Update()) { // return only status on success. Response.StatusCode = (int)HttpStatusCode.OK; return new EmptyResult(); } // TODO: this should return JsonError somehow... return new ViewResult() { ViewName = "Error" }; }
public ActionResult GetDetailJson(OrgUnit ou) { ou.LoadDetail(); // trying returning self without specifying Json... // TODO: AjaxAttribute ? to tag properties for Json serialization. var jr = new JsonResult() { Data = ou, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return jr; }
public ActionResult GetNodeJson(OrgUnit ou) { //var sw = new Stopwatch(); //sw.Start(); ou.LoadFromDb(); //var et = sw.ElapsedMilliseconds; // 48, 11, 8, 6, 6 in 5 subsequent refreshes var jr = new JsonResult() { // *note*, this returns a List<JsTreeNode> of one root node. multi-roots are also possible. //Data = Models.JsTreeNode.GetDummyTree() Data = new Models.JsTreeNode(ou), JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return jr; }