public ActionResult Replace(SourceFileDataViewModel vm) { if (ModelState.IsValid && vm.FileData != null) { Source s = this.sourceTasks.GetSource(vm.Id); if (s != null) { using (Stream inputStream = vm.FileData.InputStream) { s.FileData = StreamUtil.StreamToBytes(inputStream); } s = this.sourceTasks.SaveSource(s); // queue indexing BackgroundJob.Enqueue <ISourceTasks>(x => x.IndexSourceQueueable(s.Id, s.HasUploadedBy() ? s.GetUploadedBy().UserID : string.Empty, s.SourceAuthors.Select(y => y.Author).ToList(), s.SourceOwningEntities.Select(y => y.Name).ToList(), s.JhroCase != null ? s.JhroCase.CaseNumber : string.Empty, this.sourceTasks.GetSourceDTO(s.Id).FileSize) ); } return(RedirectToAction("Index", "Sources", new { area = "Profiling" })); } return(Replace(vm.Id)); }
public ActionResult Replace(int id) { Source s = this.sourceTasks.GetSource(id); if (s != null) { SourceFileDataViewModel vm = new SourceFileDataViewModel(s); return(View(vm)); } return(new HttpNotFoundResult()); }