BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler.GetRecentPosts C# (CSharp) Method

GetRecentPosts() private method

metaWeblog.getRecentPosts method
private GetRecentPosts ( string blogId, string userName, string password, int numberOfPosts ) : List
blogId string /// always 1000 in BlogEngine since it is a singlar blog instance ///
userName string /// login username ///
password string /// login password ///
numberOfPosts int /// number of posts to return ///
return List
        internal List<MWAPost> GetRecentPosts(string blogId, string userName, string password, int numberOfPosts)
        {
            var sendPosts = new List<MWAPost>();
            var posts = Post.Posts.Where(p => p.IsVisible).ToList();

            // Set End Point
            var stop = numberOfPosts;
            if (stop > posts.Count)
            {
                stop = posts.Count;
            }

            foreach (var post in posts.GetRange(0, stop))
            {
                var tempPost = new MWAPost
                    {
                        postID = post.Id.ToString(),
                        postDate = post.DateCreated,
                        title = post.Title,
                        description = post.Content,
                        link = post.AbsoluteLink.AbsoluteUri,
                        slug = post.Slug,
                        excerpt = post.Description,
                        commentPolicy = post.HasCommentsEnabled ? string.Empty : "0",
                        publish = post.IsPublished
                    };

                var tempCats = post.Categories.Select(t => Category.GetCategory(t.Id).ToString()).ToList();

                tempPost.categories = tempCats;

                var tempTags = post.Tags.ToList();

                tempPost.tags = tempTags;

                sendPosts.Add(tempPost);
            }

            return sendPosts;
        }