Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs	(revision 13754)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs	(revision 13782)
@@ -1,3 +1,4 @@
-﻿using HeuristicLab.Clients.Access.Administration;
+﻿using HeuristicLab.Clients.Access;
+using HeuristicLab.Clients.Access.Administration;
 using HeuristicLab.Clients.Hive.WebJobManager.Services;
 using Microsoft.AspNet.Hosting;
@@ -8,4 +9,5 @@
 using System.Linq;
 using System.ServiceModel.Security;
+using System.Threading;
 using System.Threading.Tasks;
 
@@ -17,4 +19,5 @@
         private HiveServiceLocatorWeb serviceLocator;
         private AccessAdministrationClient accessClient;
+        private HiveAdminClientWeb adminClient;
         private Guid userId;
 
@@ -37,4 +40,5 @@
                 userId = Guid.Parse(u);
                 serviceLocator = weblog.getServiceLocator(userId);
+                adminClient = weblog.getAdminClient(userId);
                 accessClient = weblog.getAccessAdminClient(userId);
                 return serviceLocator.CheckLogin();
@@ -56,4 +60,96 @@
             }
         }
+        [HttpPost]
+        public IActionResult changeParent(string inpid, string inpidpar)
+        {
+            if (init())
+            {
+                var gid = Guid.Parse(inpid);
+                
+
+                adminClient.Refresh();
+                var tochange = adminClient.Resources.ToList().Find(x => x.Id == gid);
+                
+                if (inpidpar != null && inpidpar != "") {
+                    Guid tempid = Guid.Parse(inpidpar);
+                    while (tempid != null)
+                    {
+                        if (tempid != gid)
+                        {
+                            tempid = (Guid)adminClient.Resources.ToList().Find(x => x.Id == tempid).ParentResourceId;
+                        }
+                        else
+                            break;
+                    }
+                    if(tempid == null)
+                        tochange.ParentResourceId = Guid.Parse(inpidpar);
+                }
+                else
+                    tochange.ParentResourceId = null;
+                adminClient.Store(tochange, CancellationToken.None);
+
+                return RedirectToAction("Index", "Resource");
+            }
+            else
+            {
+                return RedirectToAction("Index", "Home");
+            }
+        }
+        [HttpPost]
+        public IActionResult deleteClientGroup(string inpid)
+        {
+            if (init())
+            {
+                var gid = Guid.Parse(inpid);
+
+                adminClient.Refresh();
+                var group = adminClient.Resources.ToList().Find(x => x.Id == gid);
+                var list = adminClient.Resources.ToList().FindAll(x => x.ParentResourceId == gid);
+                foreach(var cl in list)
+                {
+                    cl.ParentResourceId = group.ParentResourceId;
+                    adminClient.Store(cl, CancellationToken.None);
+                }
+                adminClient.Delete(group);
+
+                return RedirectToAction("Index", "Resource");
+            }
+            else
+            {
+                return RedirectToAction("Index", "Home");
+            }
+        }
+
+        [HttpPost]
+        public IActionResult newClientGroup(string inpname, int inpheart, string inpparent, string[] clientstoadd)
+        {
+            if (init()) {
+                adminClient.Refresh();
+
+                SlaveGroup sg = new SlaveGroup();
+                sg.Id = Guid.Empty;
+                sg.Name = inpname;
+                sg.HbInterval = inpheart;
+                if (inpparent != "")
+                    sg.ParentResourceId = Guid.Parse(inpparent);
+                sg.OwnerUserId = serviceLocator.getHiveServiceClient().GetUserIdByUsername(serviceLocator.getHiveServiceClient().ClientCredentials.UserName.UserName);
+                adminClient.Store(sg, CancellationToken.None);
+                adminClient.Refresh();
+                var id = adminClient.Resources.ToList().Find(x => x.Name == inpname).Id;
+                foreach(var s in clientstoadd)
+                {
+                    var cid = Guid.Parse(s);
+                    var client = adminClient.Resources.ToList().Find(x => x.Id == cid);
+                    client.ParentResourceId = id;
+                    adminClient.Store(client, CancellationToken.None);
+                }
+
+                return RedirectToAction("Index", "Resource");
+            }
+            else
+            {
+                return RedirectToAction("Index", "Home");
+            }
+        }
     }
 }
