root dir management is fully functional.

This commit is contained in:
Keivan Beigi 2013-01-24 17:22:14 -08:00 committed by kay.one
commit b50cd19add
5 changed files with 21 additions and 9 deletions

View file

@ -16,17 +16,24 @@ namespace NzbDrone.Api.QualityProfiles
Get["/"] = x => GetRootFolders();
Post["/"] = x => AddRootFolder();
Delete["/{id}"] = x => DeleteRootFolder((int)x.id);
}
private Response AddRootFolder()
{
_rootDirProvider.Add(Request.Body.FromJson<RootDir>());
return new Response { StatusCode = HttpStatusCode.Created };
var dir = _rootDirProvider.Add(Request.Body.FromJson<RootDir>());
return dir.AsResponse(HttpStatusCode.Created);
}
private Response GetRootFolders()
{
return _rootDirProvider.AllWithFreeSpace().AsResponse();
}
private Response DeleteRootFolder(int folderId)
{
_rootDirProvider.Remove(folderId);
return new Response { StatusCode = HttpStatusCode.OK };
}
}
}