Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: user submitted data types not appearing in the console

$
0
0
Its due to some weirdness in the datalayer, where you can easily end up with "corrupted" data when trying to save unpublished data in the published scope.

Long story short, the Data attribute on a Razor function will per default give you a DataConnection working with Published data. Unfortunately there is no check when saving data on such a connection whether the PublicationStatus value is valid, so you end up having data which is in draft-mode in store which is supposed to hold only published data.

To correct this, you should save the data in the razor view like this
using (var unpublishedData = new DataConnection(PublicationScope.Unpublished)) 
{
        var notice = unpublishedData .New<iZIO.Community.Notices.Notice>();

        notice.Subject = subject;
        notice.Message = message;
        notice.PublicationStatus = "draft";

        notice = unpublishedData .Add<iZIO.Community.Notices.Notice>(notice);
}

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>