private string Upload(string fileName, Stream source) { string retVal = null; using (var info = new UploadStreamInfo()) { Folder folder = null; try { folder = _assetProvider.GetFolderById("export"); } catch (Exception e) { retVal = e.Message; } finally { folder = folder ?? _assetProvider.CreateFolder("export", null); } if (folder != null) { retVal = null; info.FileName = string.Format("{0}{1}{2}", folder.FolderId, "/", Path.GetFileName(fileName)); info.FileByteStream = source; info.Length = source.Length; try { _assetProvider.Upload(info); } catch (Exception e) { retVal = string.Format("Couldn't upload exported file: {0}", e.Message); } } else { retVal = string.Format("Export folder not found and can't be created: {0}", retVal); } } return(retVal); }
private void RaiseCreateFolderRequest() { var inputVm = _inputNameVmFactory.GetViewModelInstance(); var confirmation = new ConditionalConfirmation { Title = "Enter new folder name".Localize(), Content = inputVm }; InputNameDialogRequest.Raise(confirmation, (x) => { if (x.Confirmed) { var inputNameDialogViewModel = x.Content as IInputNameDialogViewModel; if (inputNameDialogViewModel != null) { var newFolderName = inputNameDialogViewModel.InputText; _assetRepository.CreateFolder(newFolderName, ParentItem.InnerItemID); LoadItems(); } } }); }