My project is running perfectly, but I would like to replace this path DirectoryInfo
with another one that pulls itself straight from the folder without needing to use my directory.
Code:
public List<Arquivos> GetArquivos()
{
List<Arquivos> lstArquivos = new List<Arquivos>();
//DirectoryInfo dirInfo = new DirectoryInfo(HostingEnvironment.MapPath("~/Arquivos"));
DirectoryInfo dirInfo = new DirectoryInfo("C:/Users/Usuario/source/repos/FEESC/FEESC/UploadedFiles");
int i = 0;
foreach (var item in dirInfo.GetFiles())
{
lstArquivos.Add(new Arquivos()
{
arquivoID = i + 1,
arquivoNome = item.Name,
arquivoCaminho = dirInfo.FullName + @"\" + item.Name
});
i = i + 1;
}
return lstArquivos;
}