private void WriteFile(object viewModel, bool keepOldCopy) { var relativePath = GetRelativePath.Invoke(viewModel, Indexes); if (keepOldCopy) { StoreOldCopyOfFile(relativePath); } var absolutePath = Path.Combine(UploadsAbsolutePhysicalPath, relativePath); var parentFolderInfo = new FileInfo(absolutePath).Directory; if (parentFolderInfo != null && !parentFolderInfo.Exists) { parentFolderInfo.Create(); } File.WriteAllBytes(absolutePath, BinaryContents); UpdateBinding?.Invoke(viewModel, null, relativePath, Indexes); #if NETFRAMEWORK var username = HttpContext.Current?.Request?.GetOwinContext()?.Request?.User?.Identity?.Name; _logger.Info($"Upload - User [{username}] uploaded File [{absolutePath}]"); #else _logger.Info($"Upload - Uploaded File [{absolutePath}]"); #endif }
private void UpdateDbBound(object viewModel) { #if NETFRAMEWORK var username = HttpContext.Current?.Request?.GetOwinContext()?.Request?.User?.Identity?.Name; _logger.Info($"Upload - User [{username}] uploaded DB File with id [{Key}]"); #else _logger.Info($"Upload - Uploaded DB File with id [{Key}]"); #endif if (IsLegacy) { UpdateBoundBinaryField(viewModel); } else { UpdateBinding?.Invoke(viewModel, BinaryContents, FileName, Indexes); } }