public IActionResult Create([FromBody] CreateDocumentoCommand command) { try { var result = _service.CreateDocumento(command); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Post([FromBody] Documento documento) { try { var identity = HttpContext.User.Identity as ClaimsIdentity; int idUsuario = JwtConfigurator.GetTokenIdUsuario(identity); documento.UsuarioId = idUsuario; documento.FechaCreacion = DateTime.Now; documento.Activo = 1; await _documentoService.CreateDocumento(documento); return(Ok(new { message = "Se agrego el documento exitosamente" })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }