コード例 #1
0
        public Blog GetDataModel()
        {
            var blog = new Blog {BlogId = BlogId, Name = Name};
            blog.Posts = new List<Post>();
            Posts.ForEach(post => blog.Posts.Add(post.GetDataModel()));

            return blog;
        }
コード例 #2
0
        public BlogViewModel(Blog blog)
        {
            BlogId = blog.BlogId;
            Name = blog.Name;
            IsInEditMode = false;
            Posts = new List<PostViewModel>();

            blog.Posts.OrderByDescending(x => x.PostId).ToList().ForEach(post =>
            {
                var addMe = new PostViewModel(post);
                Posts.Add(addMe);
            });
        }