示例#1
0
        public async Task <List <Response> > PostTitleData([FromBody] string[] data)
        {
            var responses = new List <Response>();
            var tasks     = data.Select(async url =>
            {
                responses.Add(await _titleService.GetTitleByUrl(url));
            });
            await Task.WhenAll(tasks);

            await _db.Responses.AddRangeAsync(responses);

            await _db.SaveChangesAsync();

            return(responses);
        }