public async Task <IEnumerable <ArtistWorkInfo> > GetArtistWorksAsync() { IEnumerable <ArtistInfo> artists = await _radiocomArtistRepository.GetArtistsAsync(); int artistWorksCount = 0; var artistInfosWorkCount = await Task.FromResult(artists.Select(x => { int workCount = random.Next(1, 15); artistWorksCount += workCount; return(artist : x, workCount); }).ToList()); if (_artistWorks == null) { _artistWorks = new List <ArtistWorkInfo>(artistWorksCount); for (int a = 0; a < artistWorksCount; a++) { _artistWorks.Add(new ArtistWorkInfo() { Id = a, Name = MockUtils.RandomString(3, 20), ArtistInfo = GetRandomArtist(artistInfosWorkCount) }); if (a % 10 == 0) { await Task.Delay(1); } } } return(_artistWorks); }
public async Task <IEnumerable <ArtistInfo> > GetArtistsAsync() { int artistsCount = random.Next(215, 300); if (_artists == null) { _artists = new List <ArtistInfo>(artistsCount); for (int a = 0; a < artistsCount; a++) { _artists.Add(new ArtistInfo() { Id = a, Name = MockUtils.RandomString(3, 20) }); if (a % 10 == 0) { await Task.Delay(1); } } } return(await Task.FromResult(_artists)); }