示例#1
0
        public ContentViewModel GetContent()
        {
            var posts      = _dataProvider.GetPosts();
            var categories = _dataProvider.GetCategoriesWithPostCategories();

            var postList = _mapper.Map <List <PostContentViewModel> >(posts);
            var catList  = _mapper.Map <List <CategoryContentViewModel> >(categories);

            return(new ContentViewModel
            {
                Categories = catList,
                Posts = postList
            });
        }