// Funcion para devolver cierto folder // POST api/folder public FolderModel Get([FromUri]string Path, [FromUri] string token) { var account = CheckPermissions(token); var model = new FolderModel(); if (CheckCuenta(account)) { model.listaModels = ListFolder(Path,account); return model; } return null; }
// Borra un folder, y te retorna el root folder // DELETE api/folder/5 public bool Delete([FromUri] string token , [FromUri]int id) { var account = CheckPermissions(token); if (CheckCuenta(account)) { var folder = _readOnlyRepository.First<File>(x => x.Id == id); if (folder != null) { folder.IsArchived = true; _writeOnlyRepository.Update(folder); var model = new FolderModel(); model.listaModels = ListRootFolder(account); return true; } } return false; }
// funcion para crear un folder, devuelve la listqa del directorio // PUT api/folder/5 public bool Put([FromUri] string folderName,[FromUri] string currentPath, [FromUri] string token) { if (currentPath == null) { currentPath = ""; } var account = CheckPermissions(token); if (CheckCuenta(account)) { if (CreateFolder(currentPath, folderName,account)) { var modelo = new FolderModel(); modelo.listaModels = ListFolder(currentPath,account); return true; } } return false; }