示例#1
0
        public async Task <string> Get()
        {
            var output = new StringBuilder();
            var links  = await _linksService.GetUnpublishedLinks();

            foreach (var category in (await _linksService.GetCategories()).Union(new[] { "" }))
            {
                if (!links.ContainsKey(category))
                {
                    continue;
                }
                output.AppendLine();
                output.AppendLine($"## {category}");
                output.AppendLine();
                foreach (var link in links[category])
                {
                    output.AppendLine($"* [{link.Title ?? "UNKNOWN"}]({link.Url}) by {link.Author ?? "UNKNOWN"}.");
                }
            }
            return(output.ToString());
        }