public async Task <ActionResult> BandDirectory() { List <Band> bands = context.Bands.Include("Social").Include("Location").ToList(); List <BandPicViewModel> models = new List <BandPicViewModel>(); foreach (Band band in bands) { BandPicViewModel temp = new BandPicViewModel(); temp.band = band; temp.facebookUrl = await FacebookAPI.GetProfilePicture(band.Social.facebookPageId); models.Add(temp); } return(View(models)); }
public async Task <ActionResult> ViewBandProfile(int bandId) { Band band = GetBand(bandId); BandProfileViewModel model = new BandProfileViewModel(); SocialMediaIds socials = GetBandSocials(band.socialId); model.band = band; model.facebookImageUrl = await FacebookAPI.GetProfilePicture(socials.facebookPageId); model.facebookPermalinks = await FacebookAPI.GetPermaUrlFromPost(socials.facebookPageId); model.youtubeUrls = await GetYoutubeUrls(band); //model.facebookPermalinks = new List<string>(); // place holder for less API calls //model.youtubeUrls = new List<string>(); model.reviews = GetBandReviews(band); model.score = AverageReviews(model.reviews); model.gigs = GetGigViewModel(GetGigs(band)); return(View(model)); }