Search code examples
razorcrud2sxc

How do I insert an entity with 2sxc in a razor script?


Instead of reading data out of 2sxc, I want to pump a list of data into a 2sxc stream. As all should run on the server-side within a razor script, I don't want to use WebApi and post every single entity.

It is possible to do CRUD operations within a razor script? Any example/demo available?


Solution

  • Finally I found it in the documentation:

    1. App.Data.Create(contentTypeName, values, userName)
    2. App.Data.Update(entityId, values, userName)
    3. App.Data.Delete(entityId, userName)

    https://2sxc.org/en/docs/Feature/feature/3360
    https://github.com/2sic/2sxc/wiki/razor-app