/// Function that returns content of folder whose name is provided as parameter. public List <Content> getFolderContent(FolderNumber folderNumber) { String path = getPath(); if (path.Length == 0) { throw new Exception("Morate unijeti putanju do svih ostalih foldera."); } String folderName = ""; try { folderName = getFolderName(path, folderNumber.FolderName); } catch (Exception ex) { throw new Exception("Definište ispravnu putanju (Administrator)."); } if (folderName.Length == 0) { throw new Exception("Ne postoji folder koji odgovara unesenom broju."); } List <Content> contents = new List <Content>(); contents = readFolder(folderName, contents); return(contents); }
public IActionResult FolderNumber(FolderNumber folderNumber) { if (ModelState.IsValid) { try { List <Content> content = readWriteInterface.getFolderContent(folderNumber); return(View("FolderContent", new FolderContent(content))); } catch (Exception ex) { return(View("FolderContent", new FolderContent(ex.Message))); } } else { return(View(folderNumber)); } }