Пример #1
0
        public void UpdateContent(Content content)
        {
            //   GetList(content.siteCode,content.CanPublish);
            var contentSummary = contents.Find(a => a.code == content.code);

            if (contentSummary == null)
            {
                contentSummary = new ContentSummary()
                {
                    hscode                        = content.HSCODE,
                    code                          = content.code,
                    subject                       = content.subject,
                    category                      = content.category,
                    tags                          = content.tags,
                    latestVersion                 = content.version,
                    description                   = content.description,
                    latestVersionStatus           = "Draft",
                    latestVersionLastModifiedBy   = User.username,
                    latestVersionLastModifiedDate = DateTime.Now,
                    rejectionNotes                = content.rejectionNotes,
                    IsHide                        = content.IsHide,
                    IsDelete                      = content.IsDelete,
                    IsReject                      = content.IsReject,
                };

                contents.Add(contentSummary);
            }
            else
            {
                contentSummary.latestVersion                 = content.version;
                contentSummary.latestVersionStatus           = "Draft";
                contentSummary.latestVersionLastModifiedBy   = User.username;
                contentSummary.latestVersionLastModifiedDate = DateTime.Now;
                contentSummary.rejectionNotes                = content.rejectionNotes;
                contentSummary.IsHide   = content.IsHide;
                contentSummary.IsDelete = content.IsDelete;
                contentSummary.IsReject = content.IsReject;
            }

            Save();
        }
Пример #2
0
        public void Publish(Content content)
        {
            var contentSummary = contents.Find(a => a.code == content.code);

            if (contentSummary == null)
            {
                contentSummary = new ContentSummary()
                {
                    code                = content.code,
                    subject             = content.subject,
                    category            = content.category,
                    tags                = content.tags,
                    latestVersion       = content.version,
                    description         = content.description,
                    latestVersionStatus = "Published",
                    publishedBy         = User.username,
                    publishedVersion    = content.version,
                    publishedDate       = DateTime.Now
                };

                contents.Add(contentSummary);
            }
            else
            {
                contentSummary.latestVersion       = content.version;
                contentSummary.subject             = content.subject;
                contentSummary.category            = content.category;
                contentSummary.description         = content.description;
                contentSummary.tags                = content.tags;
                contentSummary.latestVersionStatus = "Published";
                contentSummary.publishedBy         = CMS.User.username;
                contentSummary.publishedVersion    = content.version;
                contentSummary.publishedDate       = DateTime.Now;
            }

            Save();
        }