Пример #1
0
 public static string RenderArtistProfileImageThumbnail(this HtmlHelper helper, Artist artist, string id, string alternateText, object htmlAttributes)
 {
     ImageMetaData imageMetaData = null;
     if(artist.ProfileImage!=null && artist.ProfileImage.Thumbnail!=null){
         imageMetaData = artist.ProfileImage.Thumbnail;
     }
     return RenderArtistProfileImageThumbnail(helper, imageMetaData, id, alternateText, htmlAttributes);
 }
Пример #2
0
 public static string RenderArtistProfileImage(this HtmlHelper helper, Artist artist)
 {
     ImageMetaData imageMetaData = null;
     if (artist.ProfileImage != null)
     {
         imageMetaData = artist.ProfileImage;
     }
     return RenderArtistProfileImageThumbnail(helper, imageMetaData, "", "", null);
 }
Пример #3
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            HttpRequestBase request = controllerContext.HttpContext.Request;

            string prefix = ModelBinderHelpers.GetPrefixForCustomModelBinder(bindingContext);

            Artist artist = null;
            if (bindingContext.Model == null)
            {
                artist = new Artist();
                artist.ID = Guid.NewGuid();
            }
            else
            {
                artist = (Artist)bindingContext.Model;
            }

            artist.Name = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Name");
            artist.Profile = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Profile");

            //Grab the style
            Guid? styleId = ModelBinderHelpers.GetValueAndUpdateModelState<Guid?>(bindingContext, "SelectedStyle");
            ListenTo.Shared.DO.Style style = null;
            if (styleId.HasValue && styleId.Value != Guid.Empty)
            {
                style = StyleManager.GetByID(styleId.Value);
                artist.Style = style;
            }

            //Grab the town
            Guid? townId = ModelBinderHelpers.GetValueAndUpdateModelState<Guid?>(bindingContext, "SelectedTown");
            Town town = null;
            if (townId.HasValue && townId.Value!=Guid.Empty)
            {
                town = TownManager.GetByID(townId.Value);
                artist.Town = town;
            }

            int month = ModelBinderHelpers.GetValueAndUpdateModelState<int>(bindingContext, "month");
            int year = ModelBinderHelpers.GetValueAndUpdateModelState<int>(bindingContext, "year");
            DateTime formedDateTime = new DateTime(year, month, 1);

            artist.Created = DateTime.Now;
            artist.Formed = formedDateTime;

            artist.OfficalWebsiteURL = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "OfficalWebsiteURL");
            artist.Email = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Email");
            artist.ProfileAddress = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "ProfileAddress");

            OwnershipHelpers.SetOwner((IOwnableDO)artist, controllerContext.HttpContext.User);

            return artist;
        }
Пример #4
0
        private void PrepareViewDataForEditAction(Artist artist)
        {
            Guid? townId = null;
            if (artist.Town != null)
            {
                townId = artist.Town.ID;
            }
            PrepareTowns(townId);

            Guid? styleId = null;
            if (artist.Style != null)
            {
                styleId = artist.Style.ID;
            }
            PrepareStyles(styleId);

            PrepareFormedDate(artist.Formed);
        }
Пример #5
0
 private bool IsUserFanOfArtist(Artist artist)
 {
     bool isUserFanOfArtist = false;
     if(this.HttpContext.User.Identity.IsAuthenticated) {
         IListenToUser user = (IListenToUser)this.HttpContext.User;
         isUserFanOfArtist = RelationshipManager.IsUserFanOfArtist(user.UserCredentials, artist.ID,user.UserId);
     }
     return isUserFanOfArtist;
 }
Пример #6
0
 public string ArtistMusicUrl(Artist artist)
 {
     return UrlHelper.RouteUrl(Routes.ARTIST_MUSIC, new { name = artist.ProfileAddress });
 }
Пример #7
0
 public string ArtistGigsUrl(Artist artist)
 {
     return UrlHelper.RouteUrl(Routes.ARTIST_GIGS, new { name = artist.ProfileAddress });
 }
Пример #8
0
 public string ViewArtistUrl(Artist artist)
 {
     return UrlHelper.RouteUrl(Routes.ARTIST, new { name = artist.ProfileAddress });
 }
Пример #9
0
 public string EditArtistUrl(Artist artist)
 {
     return UrlHelper.RouteUrl(Routes.ARTIST_EDIT, new { id = artist.ID });
 }
Пример #10
0
 public string BecomeAFanUrl(Artist artist)
 {
     return UrlHelper.RouteUrl(Routes.ARTIST_BECOME_A_FAN, new { profileAddress = artist.ProfileAddress });
 }
Пример #11
0
        private void AddActToGig(Gig gig, Artist artist, string name)
        {
            Act currentAct = new Act();
            currentAct.ID = Guid.NewGuid();
            currentAct.GigId = gig.ID;
            if (artist!=null)
            {
                currentAct.Name = artist.Name;
                currentAct.Artist = artist;
            }
            else
            {
                currentAct.Name = name;
            }

            gig.Acts.Add(currentAct);
        }
Пример #12
0
 public static string EditArtistUrl(this HtmlHelper helper, Artist artist)
 {
     return IOCHelper.GetRouteHelpers().EditArtistUrl(artist);
 }
Пример #13
0
 public static string BecomeAFanUrl(this HtmlHelper helper, Artist artist)
 {
     return IOCHelper.GetRouteHelpers().BecomeAFanUrl(artist);
 }
Пример #14
0
 public static string ArtistMusicUrl(this HtmlHelper helper, Artist artist)
 {
     return IOCHelper.GetRouteHelpers().ArtistMusicUrl(artist);
 }
Пример #15
0
 public RedirectToRouteResult RedirectToArtist(Artist artist)
 {
     return RedirectToRoute(Routes.ARTIST, new { name = artist.ProfileAddress  });
 }
Пример #16
0
 public static string RenderArtistProfileImageThumbnail(this HtmlHelper helper, Artist artist)
 {
     return RenderArtistProfileImageThumbnail(helper,artist,"","",null);
 }