private async Task LoadIfUserRelated() { var reviews = await _reviewService.Get <List <Review> >(new ReviewSearchRequest() { UserId = UserRelatedReviews }); foreach (var item in reviews) { var query = await _postService.Get <List <Post> >(new PostSearchRequest() { ReviewRelatedId = item.ReviewId }); var thisPost = query.FirstOrDefault(); ReviewPostHelperVM local = new ReviewPostHelperVM() { ReviewId = item.ReviewId, FavouriteSongs = item.FavouriteSongs, LeastFavouriteSongs = item.LeastFavouriteSongs, PostDateTime = thisPost.PostDateTime, PostId = thisPost.PostId, PostPhoto = thisPost.PostPhoto, Username = thisPost.AdminName, Rating = "Rating: " + item.Rating.ToString() + "/5", ReviewText = item.ReviewText }; ReviewList.Add(local); } }
private async Task LoadIfArtistRelated() { var albums = await _albumService.Get <List <Album> >(new AlbumSearchRequest() { ArtistId = ArtistRelatedReviews }); foreach (var item in albums) { var reviews = await _reviewService.Get <List <Review> >(new ReviewSearchRequest() { AlbumId = item.AlbumId }); foreach (var x in reviews) { var returnedPost = await _postService.Get <List <Post> >(new PostSearchRequest() { ReviewRelatedId = x.ReviewId }); var thisPost = returnedPost.FirstOrDefault(); ReviewPostHelperVM local = new ReviewPostHelperVM() { ReviewId = x.ReviewId, FavouriteSongs = x.FavouriteSongs, LeastFavouriteSongs = x.LeastFavouriteSongs, PostDateTime = thisPost.PostDateTime, PostId = thisPost.PostId, Username = thisPost.AdminName, PostPhoto = thisPost.PostPhoto, Rating = "Rating: " + x.Rating.ToString() + "/5", ReviewText = x.ReviewText }; ReviewList.Add(local); } } }