public List <CategoryModel> Get()
        {
            var parameters = new
            {
            };
            var categories = GetService.GetDataAccessService().LoadData <CategoryModel, dynamic>("GetAllCategories", parameters, "DataConnection");

            return(categories);
        }
        public CategoryModel GetPublishedArticlesById(int id)
        {
            var parameters = new
            {
                CategoryID = id
            };
            var category = GetService.GetDataAccessService().LoadData <CategoryModel, dynamic>("GetCategoriesById", parameters, "DataConnection");

            return(category.FirstOrDefault());
        }
Beispiel #3
0
        public List <ArticleModel> GetArticlesByTitle(string title)
        {
            var parameters = new
            {
                Title = title
            };
            var articles = GetService.GetDataAccessService().LoadData <ArticleModel, dynamic>("GetArticlesByTitle", parameters, "DataConnection");

            foreach (var article in articles)
            {
                var categories = GetService.GetCategoryService().GetArticleCategoriesbyArticleId(article.ArticleID);
                article.Categories = categories;
            }

            return(articles);
        }
        public List <CategoryModel> GetArticleCategoriesbyArticleId(int id)
        {
            try
            {
                var parameters = new
                {
                    ArticleID = id
                };

                var categories = GetService.GetDataAccessService().LoadData <CategoryModel, dynamic>("GetArticleCategoriesById", parameters, "DataConnection");

                return(categories);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        public ArticleModel GetAllArticlesById(int id)
        {
            try
            {
                var parameters = new
                {
                    ArticleID = id
                };

                var article = GetService.GetDataAccessService().LoadData <ArticleModel, dynamic>("GetAllArticlesById", parameters, "DataConnection").FirstOrDefault();

                var categories = GetService.GetCategoryService().GetArticleCategoriesbyArticleId(id);
                article.Categories = categories;


                return(article);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #6
0
        public List <ArticleModel> Get()
        {
            try
            {
                var parameters = new
                {
                };

                var articles = GetService.GetDataAccessService().LoadData <ArticleModel, dynamic>("GetAllArticles", parameters, "DataConnection");

                foreach (var article in articles)
                {
                    var categories = GetService.GetCategoryService().GetArticleCategoriesbyArticleId(article.ArticleID);
                    article.Categories = categories;
                }

                return(articles);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }