public async Task <List <string> > GetYoutubeUrls(Band band) // returns urls for top 3 youtube videos!! { //Band band = GetBand(bandId); SocialMediaIds socials = context.Socials.Where(s => s.SocialId == band.socialId).FirstOrDefault(); YouTubeAPI youtube = new YouTubeAPI(); List <string> YoutubeUrls = await youtube.GetUrlsOfTopVideos(socials.youtubeChannelId); return(YoutubeUrls); }
// GET: Band/Create public ActionResult Create() { CreateAndEditViewModel createView = new CreateAndEditViewModel(); Location location = new Location(); createView.Location = location; Band band = new Band(); createView.Band = band; SocialMediaIds social = new SocialMediaIds(); createView.Social = social; return(View(createView)); }
public async Task <ActionResult> Edit(CreateAndEditViewModel input) { try { Band currentBand = GetUserBand(); Location currentLocation = GetBandLocation(currentBand); SocialMediaIds currentSocials = GetBandSocials(currentBand); currentBand.BandId = input.Band.BandId; currentBand.bandName = input.Band.bandName; currentBand.genre = input.Band.genre; currentBand.bandWebsite = input.Band.bandWebsite; currentBand.ApplicationId = input.Band.ApplicationId; currentLocation.address1 = input.Location.address1; currentLocation.address2 = input.Location.address2; currentLocation.city = input.Location.city; currentLocation.zip = input.Location.zip; currentLocation.state = input.Location.state; currentSocials.facebookPageId = input.Social.facebookPageId; currentSocials.twitterHandle = input.Social.twitterHandle; currentSocials.youtubeChannelId = input.Social.youtubeChannelId; string[] latLng = await GeoCode.GetLatLongFromApi(currentLocation); currentLocation.lat = latLng[0]; currentLocation.lng = latLng[1]; await context.SaveChangesAsync(); return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }
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)); }
public SocialMediaIds GetBandSocials(Band band) { SocialMediaIds currentSocials = context.Socials.Where(s => s.SocialId == band.socialId).FirstOrDefault(); return(currentSocials); }
public SocialMediaIds GetBandSocials(int id) { SocialMediaIds bandInfo = context.Socials.Where(s => s.SocialId == id).FirstOrDefault(); return(bandInfo); }