ContentItems not persisted #12736
Unanswered
ricocsharp
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Normally you should provide the type of your part |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm creating ContentItems via code, there are no errors and debugging the creation Method I can see all the info about the new contentItem, but at the end this new ContentItem is not presisted in DB here is the fragment of code:
var contentItem = await _contentManager.NewAsync(productoContentType);
contentItem.Owner = User.Identity.Name;
contentItem.Alter(part =>
{
part.Categoria = details.Categoria;
part.Cup = details.Cup;
part.Hsa = details.Hsa;
part.Envase = details.Envase;
part.Marca = details.Marca;
part.Tipo = details.Tipo;
part.NormaCajon = details.NormaCajon;
part.NormaMC = details.NormaMC;
part.PesoNeto = details.PesoNeto;
part.VitolaGalera = details.VitolaGalera;
part.VitolaSalida = details.VitolaSalida;
});
try
{
await _contentManager.UpdateValidateAndCreateAsync(contentItem, VersionOptions.Draft);
await _contentManager.PublishAsync(contentItem);
}
catch (Exception ex)
{
Beta Was this translation helpful? Give feedback.
All reactions