private void InitCategories() { Categories = TopCategories.Select(c => new Category { Id = c.Id, Name = c.Name }).ToList(); }
/// <summary> /// Retrieves top categories with thumbnails. /// </summary> /// <param name="categoryThumbnailsCount">The number of thumbnails per each category.</param> /// <param name="continuationToken">Optional. The continuation token. By default, null.</param> /// <returns>The category list.</returns> public async Task <List <CategoryPreview> > GetTopCategories(int categoryThumbnailsCount, string continuationToken = null) { await SimulateWaitAndError(); if (!string.IsNullOrEmpty(continuationToken)) { return(new List <CategoryPreview>()); } return(TopCategories.Select(c => new CategoryPreview { Id = c.Id, Name = c.Name, PhotoThumbnails = c.PhotoThumbnails.Take(categoryThumbnailsCount).ToList() }).ToList()); }
private void InitPhotoStreams() { PhotoStreams = new List <PhotoStream>(); var captions = new[] { "Yay!", "Having a good day!", "Enjoying... :)", "Isn't that a beautiful shot?", "I like it this way!", "Love it!", "Look at this..." }; var users = _sampleUsers; var userIndex = 0; PhotoStreams.AddRange(TopCategories.Select(c => { var createdAtMinutes = 45; return(new PhotoStream { CateogoryId = c.Id, Photos = c.PhotoThumbnails.Select(thumb => new Photo { Id = Guid.NewGuid().ToString(), Caption = captions[_random.Next(captions.Length)], ThumbnailUrl = thumb.ImageUrl, HighResolutionUrl = thumb.ImageUrl.Replace("_tn", ""), StandardUrl = thumb.ImageUrl.Replace("_tn", ""), CreatedAt = DateTime.Now.AddMinutes(createdAtMinutes -= 55), User = users[userIndex++ % users.Count], GoldCount = _random.Next(10), NumberOfAnnotations = 2, CategoryId = c.Id, CategoryName = c.Name, Status = PhotoStatus.Active }) .OrderByDescending(p => p.CreatedAt) .ToList() }); })); }