Example #1
0
        public Task <DomainModel.Directory> LoadAsync(string id)
        {
            var directoryContext = new DirectoryContext(id);

            directoryContext.DemandAccess();

            var files = directoryContext.GetFiles()
                        .Select(file => new DomainModel.File(file.Name, new FileContentLoadingPolicy(file.Path)))
                        .ToArray();

            return(Task.FromResult(new DomainModel.Directory(id, files)));
        }
Example #2
0
        public async Task SaveAsync(DomainModel.Directory directory)
        {
            var directoryContext = new DirectoryContext(directory.Id);

            directoryContext.DemandAccess();

            foreach (var file in directory.GetNewFiles())
            {
                directoryContext.CreateFile(file.Name, file.Content);
            }

            directory.Commit();
            await Task.Yield();
        }