0
votes

I'm trying to write my own API to fill an orchard core content type which has several text field. for example the content type named "test" has two fields named first name and last name and are text fields. I know by using contentItem.Content.test.firstName.Text.Value I can get the value. but as I use contentItem.Content.test.firstName="Mary" and then calling createAsync, just a new content Item is created which is empty. would you please help me? thanks

ps:test is the part name too

1
Hi, can you please provide more details of what is your problem? What have you tried so far and what was the result? What references have you reviewed?Jason D
I solved the problem.I shod create a dynamic Json variable and use that variableSoudabeh Parsa
here is part of my code: string jsonLastName = $@"{{Text: '{LastName}'}}"; string jsonAddress = $@"{{Text: '{Address}'}}"; JObject rssLastName = JObject.Parse(jsonLastName); JObject rssAddress = JObject.Parse(jsonAddress); contentItem.Content.WebSiteAgentRegistration.LastName = rssLastName.First.Root; contentItem.Content.WebSiteAgentRegistration.Address = rssAddress.First.Root;Soudabeh Parsa
Soudabeh in the future please post your code inside of the question. Please look here for best practices regarding questions on Stack Overflow: stackoverflow.com/help/how-to-askJason D
@JasonD Sure. Thanks for your attentionSoudabeh Parsa

1 Answers

0
votes

I solved the problem by using dynamic object variable