Exemplo n.º 1
0
        public List <ArticleBL> GetAll()
        {
            DALToBLMapper    poMapper       = new DALToBLMapper();
            List <Article>   articles       = DAL.SDK.Kit.Instance.Articles.GetAll();
            List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList();

            return(mappedArticles);
        }
Exemplo n.º 2
0
        public List <ArticleBL> GetBySubcategoryId(int SubcategoryId)
        {
            DALToBLMapper  poMapper = new DALToBLMapper();
            List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetArticlesBySubcategoryId(SubcategoryId);

            for (int i = 0; i < articles.Count(); i++)
            {
                articles[i].Comments = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articles[i].Id);
            }
            List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList();

            return(mappedArticles);
        }
Exemplo n.º 3
0
        public List <ArticleBL> GetLatests(int nr)
        {
            DALToBLMapper  poMapper = new DALToBLMapper();
            List <Article> articles = DAL.SDK.Kit.Instance.Articles.GetLatestsArticles(nr);

            for (int i = 0; i < articles.Count(); i++)
            {
                articles[i].Comments = DAL.SDK.Kit.Instance.Comments.GetCommentsByArticleById(articles[i].Id);
                articles[i].Title    = articles[i].Title.GetLiteralAndNumericalFromString();
            }
            List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList();

            return(mappedArticles);
        }
Exemplo n.º 4
0
        public List <ArticlesPerMonth> GetAllByMonth()
        {
            DALToBLMapper    poMapper       = new DALToBLMapper();
            List <Article>   articles       = DAL.SDK.Kit.Instance.Articles.GetAll();
            List <ArticleBL> mappedArticles = poMapper.MapArticleCollection(articles).ToList();

            var orderedArticles = mappedArticles.OrderBy(date => date.CreatedDate).ToList();

            List <ArticlesPerMonth> articlesperMonthArray = new List <ArticlesPerMonth>();
            List <ArticleBL>        listArticle           = new List <ArticleBL>();
            var month = 0;
            int year  = 0;

            foreach (var item in mappedArticles)
            {
                if (year < item.CreatedDate.Year || month < item.CreatedDate.Month)
                {
                    if (listArticle.Count > 0)
                    {
                        articlesperMonthArray.Add(new ArticlesPerMonth()
                        {
                            articles = listArticle,
                            Month    = month,
                            Year     = year
                        });
                    }
                    listArticle = new List <ArticleBL>();
                }

                listArticle.Add(item);

                year  = item.CreatedDate.Year;
                month = item.CreatedDate.Month;
            }

            articlesperMonthArray.Add(new ArticlesPerMonth()
            {
                articles = listArticle,
                Month    = month,
                Year     = year
            });

            return(articlesperMonthArray);
        }