protected async void FormSubmit() { int.TryParse(ParentId, out int parentId); model.ParentId = parentId; #region 일 업로드 관련 추가 코드 영역 if (selectedFiles != null && selectedFiles.Length > 0) { // 파일 업로드 var file = selectedFiles.FirstOrDefault(); var fileName = ""; int fileSize = 0; if (file != null) { fileName = file.Name; fileSize = Convert.ToInt32(file.Size); // 첨부 파일 삭제 await FileStorageManager.DeleteAsync(model.FileName, ""); // 다시 업로드 fileName = await FileStorageManager.UploadAsync(file.Data, file.Name, "", true); model.FileName = fileName; model.FileSize = fileSize; } } #endregion await UploadRepositoryAsyncReference.EditAsync(model); NavigationManagerReference.NavigateTo("/Uploads"); }
protected async void FormSubmit() { int.TryParse(ParentId, out int parentId); model.ParentId = parentId; await UploadRepositoryAsyncReference.EditAsync(model); NavigationManagerReference.NavigateTo("/Boards/Uploads"); }
protected async void ToggleClick() { this.model.IsPinned = (this.model?.IsPinned == true) ? false : true; await UploadRepositoryAsyncReference.EditAsync(this.model); IsInlineDialogShow = false; this.model = new BoardUploads(); await DisplayData(); }
protected async void DownloadBy(LibraryModel model) { if (!string.IsNullOrEmpty(model.FileName)) { byte[] fileBytes = await FileStorageManager.DownloadAsync(model.FileName, ""); if (fileBytes != null) { // DownCount model.DownCount = model.DownCount + 1; await UploadRepositoryAsyncReference.EditAsync(model); await FileUtil.SaveAs(JSRuntime, model.FileName, fileBytes); } } }