Exemple #1
0
        public IEnumerable <PostViewModel> GetAllPost()
        {
            var data = (from s in _unitOfWork.PostRepository.Get()
                        select new PostViewModel
            {
                PostID = s.PostID,
                Title = s.Title,
                Content = s.Content,
                FeaturedImageUrl = s.FeaturedImageUrl,
                Url = s.Url,
                CreatedDate = s.CreatedDate,
                Author = s.Author,
                ModifiedBy = s.ModifiedBy,
                ModifiedDate = s.ModifiedDate,
                Terms = GetTermByPost(s.PostID),
                FeaturedPost = GetFeaturedPost(),
                Time = _timehelper.CalculateTime(s.CreatedDate)
            }).AsEnumerable();

            return(data);
        }