示例#1
0
        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);
        }
示例#2
0
        // 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));
        }
示例#3
0
        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());
            }
        }
示例#4
0
        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));
        }
示例#5
0
        public SocialMediaIds GetBandSocials(Band band)
        {
            SocialMediaIds currentSocials = context.Socials.Where(s => s.SocialId == band.socialId).FirstOrDefault();

            return(currentSocials);
        }
示例#6
0
        public SocialMediaIds GetBandSocials(int id)
        {
            SocialMediaIds bandInfo = context.Socials.Where(s => s.SocialId == id).FirstOrDefault();

            return(bandInfo);
        }