public async Task <IActionResult> Index(IFormFile file) { var fileStream = new MemoryStream(); var user = await this.GetCurrentUser(); await file.CopyToAsync(fileStream); await uploadFileCommand.Execute(fileStream, file.FileName, user.Id); return(RedirectToAction("Index", "Document")); }
public async Task <JsonResult> UploadPresentation(string schemaName) { currentSchema.Name = schemaName; var user = await this.GetCurrentUser(); var file = Request.Form.Files[0]; using (var filestream = file.OpenReadStream()) { var documentId = await uploadFileCommand.Execute(filestream, file.FileName, user.Id); return(new JsonResult(new { documentId })); } }
public async Task <IActionResult> Index(PresentationDto dto, IFormFile file) { var user = await this.GetCurrentUser(); dto.CreatedBy = user.Id; var fileStream = new MemoryStream(); await file.CopyToAsync(fileStream); var documentId = await uploadFileCommand.Execute(fileStream, file.FileName, user.Id); dto.DocumentId = documentId; Console.WriteLine($"Created document ${dto.DocumentId}"); await createPresentationCommand.Execute(dto); return(RedirectToAction("Index", "Home")); }
public IHttpActionResult PostT_Archivo(Data.T_Archivo model) { var Result = _IUploadFileCommand.Execute(model); return(Created(Request.RequestUri, Result)); }