Beispiel #1
0
        public async Task <List <BlogPost> > GetBlogPostIdsFromTags(string[] tags)
        {
            TagFile tagFile = await GetTagFile();

            Dictionary <int, BlogPost> posts = new Dictionary <int, BlogPost>();

            foreach (var idObject in tagFile.GetIdsFromTags(tags))
            {
                int      id      = Int32.Parse(idObject);
                BlogPost newPost = new BlogPost(id);
                newPost.Blurb = true;

                if (posts.TryGetValue(id, out BlogPost value) == false)
                {
                    posts.Add(id, newPost);
                }
            }

            return(posts.Values.ToList());
        }