Esempio n. 1
0
        public static ReviewArticle NewReviewArticle(int categoryId)
        {
            var aRep = DependencyResolver.Current.GetService <IArticleRepository>();
            var cRep = DependencyResolver.Current.GetService <IConfigRepository>();

            var articleType   = new Objects.ArticleType(aRep.FetchType(ArticleTypeEnum.Review.ToString()));
            var reviewArticle = new ReviewArticle
            {
                EditableContent = new List <EditableDivProperty>(),
                Title           = new TitleTextBoxProperty {
                    Value = ""
                },
                Images        = new List <ImageProperty>(),
                Ratings       = RatingProperty.BuildXmlProperty(cRep.FetchRatings(articleType.ArticleTypeId, categoryId)).ToList(),
                State         = Core.Enums.ArticleState.Incomplete,
                SiteId        = 1,
                Date          = DateTime.Today,
                ArticleTypeId = articleType.ArticleTypeId,
                CategoryId    = categoryId
            };

            reviewArticle.Ratings.Add(new RatingProperty("Summary")
            {
                Name = "Summary"
            });
            reviewArticle.MarkNew();
            return(reviewArticle);
        }
Esempio n. 2
0
 set => SetValue(RatingProperty, value);
Esempio n. 3
0
        public static void Update(int articleId, string title, string url, string linkName, EditableDivProperty content, DateTime date, ImageProperty image, RatingProperty summary)
        {
            var bRep = DependencyResolver.Current.GetService <IBulletinRepository>();

            url = HttpUtility.HtmlEncode(url);
            var bulletin = (ReviewBulletin)LoadForArticle(articleId, bRep);

            bulletin.Title.Value          = title;
            bulletin.Link.Value           = linkName;
            bulletin.Link.Link            = url;
            bulletin.ViewContent.Value    = content.Value;
            bulletin.ViewContent.Type     = content.Type;
            bulletin.ViewContent.CssClass = content.CssClass;
            bulletin.Date  = date;
            bulletin.Image = image;

            bulletin.MarkDirty();
            bulletin.Save(bRep);
        }
Esempio n. 4
0
 set => this.SetValue(RatingProperty, value);
Esempio n. 5
0
        public static void Create(int articleId, string title, string url, string linkName, EditableDivProperty content, DateTime date, ImageProperty image, RatingProperty summary)
        {
            var bRep = DependencyResolver.Current.GetService <IBulletinRepository>();

            url = HttpUtility.HtmlEncode(url);
            var bulletin = new ReviewBulletin
            {
                ArticleId = articleId,
                Title     = new TitleTextBoxProperty {
                    Value = title
                },
                Link = new ReadMoreLinkProperty {
                    Value = linkName, Link = url
                },
                ViewContent = new StandardTextProperty {
                    Value = content.Value, Type = content.Type, CssClass = content.CssClass
                },
                Summary      = summary,
                SiteId       = 1,
                Date         = date,
                BulletinType = new BulletinType(bRep.FetchType("review")),
                Image        = image
            };

            bulletin.MarkNew();
            bulletin.Save(bRep);
        }