/// <summary> /// Gets all posts by the specified tag in the specified category with a max number of results /// </summary> /// <param name="tagName"></param> /// <param name="category"></param> /// <param name="numberOfPosts"></param> /// <returns></returns> public PostCollection PostsByTagAndCategory(string tagName, Category category, int numberOfPosts) { if (category == null) { return(null); } if (String.IsNullOrEmpty(tagName)) { return(PostsByCategory(category, numberOfPosts)); } else { PostCollection temp = Post.FetchPostsByTagAndCategory(tagName, category.Id); PostCollection pc = new PostCollection(); int tempCount = 0; foreach (Post p in temp) { tempCount++; if (tempCount > numberOfPosts) { break; } pc.Add(p); } return(pc); } }