Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class MinhaViewModel{
  2.  
  3. public int UsuarioId { get; set; }
  4.  
  5. public string Descricao { get; set; }
  6. }
  7.  
  8. [HttpPost]
  9. [Route("Publicar")]
  10. public async Task<IActionResult> PostDocumentoUsuario([FromForm] MinhaViewModel viewModel, IFormFile file){
  11. //save file to path and viewModel to database
  12. }
  13.  
  14. publicaArquivoUsuario(dadosUsuario):Observable<any>{
  15. var data = new FormData();
  16. data.append('usuarioId', dadosUsuario.usuarioId);
  17. data.append('descricao', dadosUsuario.descricao);
  18. data.append('file', dadosUsuario.file); //dadosUsuario.file é do tipo File
  19.  
  20. return this.http.post("urlApi", data, httpOptions);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement