public Source Add(Source source) { using (var ctx = new Context()) { var added = ctx.Sources.Add(source); ctx.SaveChanges(); return added.Entity; } }
public async Task<StorageFolder> GetStorageFolderFromSourceAsync(Source source) { var f = _repository.Find(x => x.Path == source.Path); var folder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(source.Token); return folder; }
private async void AddSource() { var picker = new FolderPicker(); picker.FileTypeFilter.Add("*"); picker.ViewMode = PickerViewMode.List; var folder = await picker.PickSingleFolderAsync(); if (folder == null) return; var source = new Source { Path = folder.Path, Token = StorageApplicationPermissions.FutureAccessList.Add(folder) }; new SourceService(new SourceRepository()).Add(source); GetAllSources(); }
public Source Add(Source source) { return _repository.Add(source); }