/// <summary> /// Converts post to blogpostdto /// </summary> /// <param name="post"></param> /// <returns>object of blogpostdto</returns> public BlogPostDTO ConvertPostToDTO(Post post) { var result = new BlogPostDTO { Id = post.Id, PostTime = post.PostTime, Title = post.Title, Paragraphs = post.Paragraphs, Username = post.Username }; return result; }
private IList<BlogPostDTO> GetListOfPosts(int num) { var result = new List<BlogPostDTO>(); for (var i = 0; i < num; i++) { var post = new BlogPostDTO { Id = i + 1, Title = "Test " + i, PostTime = DateTime.Now.AddDays(i) }; result.Add(post); } return result; }
private BlogPostWrapper GetWrapper(int num) { var blogList = new List<BlogPostDTO>(); for (var i = 0; i < num; i++) { var post = new BlogPostDTO { Id = i + 1, Title = "Test " + i, PostTime = DateTime.Now.AddDays(i) }; blogList.Add(post); } var result = new BlogPostWrapper { BlogPosts = blogList, Pagination = new BlogApi.Core.Models.Pagination { Total = 110 } }; return result; }