Esempio n. 1
0
        public virtual async Task <List <T> > GetListAsync()
        {
            var fileNames = await _fileManager.GetFileNamesAsync();

            var tasks = new List <Task <string> >();

            foreach (var fileName in fileNames)
            {
                tasks.Add(_fileManager.GetTextFileAsync(fileName));
            }

            IEnumerable <string> jsonFiles = Task.WhenAll(tasks).Result;

            var list = new List <T>();

            foreach (var json in jsonFiles)
            {
                var item = JsonConvert.DeserializeObject <T>(json);
                list.Add(item);
            }

            return(list);
        }
Esempio n. 2
0
 public virtual async Task <List <string> > GetFileNamesAsync()
 {
     return(await _fileManager.GetFileNamesAsync());
 }