public object Post (DtoNode req) { Scheduler.AddNode (req.address, req.port); return new HttpResult {StatusCode = HttpStatusCode.Created};/* if (Scheduler.aGetNodes ().Contains (req)) { Console.WriteLine ("Taki już jest"); return new HttpResult { StatusCode = HttpStatusCode.Conflict }; } else { Scheduler.AddNode (req.address, req.port); return new HttpResult {StatusCode = HttpStatusCode.Created}; }*/ }
public object Delete (DtoNode req) { string[] temp = req.id.Split ('_'); Scheduler.RemoveNode (temp[0], int.Parse(temp[1])); return new HttpResult { StatusCode = HttpStatusCode.OK };/* if (Scheduler.aGetNodes ().Find(p => p.id == req.id) != null) { Scheduler.RemoveNode (req.address, req.port); return new HttpResult { StatusCode = HttpStatusCode.OK }; } else { Console.WriteLine ("Nie ma takiego"); return new HttpResult {StatusCode = HttpStatusCode.Conflict}; }*/ }
public object Get (DtoNode req) { return new DtoNodeResponse (Scheduler.aGetNodes()); }