public async Task <dynamic> CriarDocumentoAsync(dynamic doc, CamposFixos conf) { if (conf.CriarSeNaoExistir) { CreateDatabaseIfNotExistsAsync().Wait(); CreateCollectionIfNotExistsAsync(conf.Sistema).Wait(); } Document document = await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, conf.Sistema), doc, null, true); return(document.ToString()); }
public ActionResult CriarValores([FromBody] JsonElement inputs) { try { dynamic objdocumento = JsonConvert.DeserializeObject <ExpandoObject>(inputs.ToString(), new ExpandoObjectConverter()); var cf = new CamposFixos(objdocumento); var response = _repo.CriarDocumentoAsync(objdocumento, cf).Result; return(Ok(response)); } catch (Exception ex) { return(BadRequest($"Ocorreu um erro ao criar um novo Valores: {ex.Message}")); } }