Ejemplo n.º 1
0
        public IEnumerable <ContentInfo3PM> SearchArticles(string tagName)
        {
            var keywords =
                tagName.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(i => i.Trim())
                .Where(i => i.Length > 2).ToList();

            var tags = from tag in TagBiz.Read()
                       from k in keywords
                       where tag.Text.Contains(k)
                       select tag.Id;

            var articles = from a in ArticleBiz.ReadPublishedArticles()
                           from k in keywords
                           where a.Title.Contains(k)
                           select a.Id;

            return(ArticleBiz.ReadPublishedArticles()
                   .Where(art =>
                          art.Tags.Any(tag => tags.Contains(tag.Id)) ||
                          articles.Contains(art.Id))
                   .OrderByDescending(a => a.PublishDate)
                   .MapTo <ContentInfo3PM>()
                   .ToList());
        }
Ejemplo n.º 2
0
 public ArticleService()
 {
     UnitOfWork = new CoreUnitOfWork();
     ArticleBiz = new ArticleBiz(UnitOfWork);
     VisitBiz   = new VisitBiz(UnitOfWork);
     CommentBiz = new CommentBiz(UnitOfWork);
     TagBiz     = new TagBiz(UnitOfWork);
 }
 public IEnumerable <TagPM> ReadTags(int pageIndex, int pageSize)
 {
     return(TagBiz.Read(tag => tag.Contents.Any(content => content.State == ContentState.Published), true)
            .OrderBy(tag => tag.Text)
            .Skip((pageIndex - 1) * pageSize)
            .Take(pageSize)
            .MapTo <TagPM>()
            .ToList());
 }
 public BlogService(IPushNotificationProvider pushNotificationProvider)
 {
     UnitOfWork               = new CoreUnitOfWork();
     BlogBiz                  = new BlogBiz(UnitOfWork);
     PublicationBiz           = new PublicationBiz(UnitOfWork);
     TagBiz                   = new TagBiz(UnitOfWork);
     FriendBiz                = new BlogLinkBiz(UnitOfWork);
     ContentBiz               = new ContentBiz(UnitOfWork);
     VisitBiz                 = new VisitBiz(UnitOfWork);
     PushNotificationProvider = pushNotificationProvider;
 }
Ejemplo n.º 5
0
 public SetupBlogService()
 {
     UnitOfWork = new CoreUnitOfWork();
     BlogBiz    = new BlogBiz(UnitOfWork);
     TagBiz     = new TagBiz(UnitOfWork);
 }
 public TagPM ReadTag(int tagId)
 {
     return(TagBiz.ReadSingle(tag => tag.Id == tagId).GetPresentationModel());
 }
 public int ReadTotallTagsCount()
 {
     return(TagBiz.Read().Count());
 }
 public TagService()
 {
     UnitOfWork = new CoreUnitOfWork();
     TagBiz     = new TagBiz(UnitOfWork);
     ArticleBiz = new ArticleBiz(UnitOfWork);
 }
 public ContentService()
 {
     UnitOfWork = new CoreUnitOfWork();
     ContentBiz = new ContentBiz(UnitOfWork);
     TagBiz     = new TagBiz(UnitOfWork);
 }