Beispiel #1
0
 public NodeVm(Node n)
 {
     _model = n;
     _attr["id"] = n.Id;
     // lazy-loadability:
     //_attr["z"] = (n.ChildCount > 0 && n.IsExpanded == false);
 }
Beispiel #2
0
 public HttpResponseMessage Put(int id, Node updated)
 {
     switch (updated.UpdateAction)
     {
         case "move":
             if (!
                 _repo.Exec("MoveOrgUnitCTS", parameters: new {
                     Id = id,
                     ParentId = updated.ParentId,
                     SibIndex = updated.SibIndex
                 }))
             {
                 return new HttpResponseMessage(HttpStatusCode.InternalServerError)
                 {
                     ReasonPhrase = "node move failed."
                 };
             }
             break;
         case "rename":
             if (!
                 _repo.Exec("RenameOrgUnitCTS", parameters: new
                 {
                     Id = id,
                     Name = updated.Name
                 }))
             {
                 return new HttpResponseMessage(HttpStatusCode.InternalServerError)
                 {
                     ReasonPhrase = "unit rename failed."
                 };
             }
             break;
         case "update":
             if (!
                 _repo.Exec("UpdateOrgUnitCTS", parameters: new
                 {
                     Id = id,
                     Code = updated.Code,
                     ShortName = updated.ShortName
                 }))
             {
                 return new HttpResponseMessage(HttpStatusCode.InternalServerError)
                 {
                     ReasonPhrase = "unit update failed."
                 };
             }
             break;
         default: break;
     }
     return new HttpResponseMessage(HttpStatusCode.OK);
 }