public GetBlogsResponse GetAll()
        {
            var response = new GetBlogsResponse();
            var list     = new List <IBlog>();

            if (_cache.Get <IList <IBlog> >(RAM.Core.ResourceStrings.Cache_BlogPosts) == null)
            {
                list = _repository.FindAll()
                       .Where(o => o.IsActive = true)
                       .OrderByDescending(o => o.DatePosted).ToList <IBlog>();
                _cache.Store(RAM.Core.ResourceStrings.Cache_BlogPosts, list);
            }
            else
            {
                list = _cache.Get <List <IBlog> >(RAM.Core.ResourceStrings.Cache_BlogPosts);
            }

            if (list != null)
            {
                response.Success  = true;
                response.Message  = "Blogs Retrieved Successfully!";
                response.BlogList = list.ToList <IBlog>();
            }
            else
            {
                response.Success = false;
                response.Message = "Blogs Retrieved Failed!";
            }

            return(response);
        }
        public GetBlogsResponse GetByCategory(GetBlogsByCategoryRequest request)
        {
            var   response = new GetBlogsResponse();
            Query query    = new Query();

            if (!string.IsNullOrEmpty(request.CategoryName))
            {
                query.Add(new Criterion("Category.Name", request.CategoryName.Replace('-', ' '), CriteriaOperator.Equal));
            }
            else
            {
                query.Add(new Criterion("BlogCategoryID", request.CategoryID, CriteriaOperator.Equal));
            }

            var list = _repository.FindBy(query)
                       .Where(o => o.IsActive = true)
                       .OrderByDescending(o => o.DatePosted);

            if (list != null)
            {
                response.Success  = true;
                response.Message  = "Blogs Retrieved Successfully!";
                response.BlogList = list.ToList <IBlog>();
            }
            else
            {
                response.Success = false;
                response.Message = "Blogs Retrieved Failed!";
            }

            return(response);
        }