Пример #1
0
 public UserProfile SetUsersProfileImage(UserProfile userProfile, byte[] data, UserCredentials userCredentials)
 {
     ListenTo.Shared.DO.Image image = ImageManager.HandleUploadedImage(data, userCredentials);
     userProfile.ProfileImage = image;
     this.Save(userProfile, userCredentials);
     return userProfile;
 }
Пример #2
0
        public static bool UserProfileHasStyle(UserProfile userProfile, StyleSummary s)
        {
            bool hasStyle = false;

            foreach (ListenTo.Shared.DO.Style userStyle in userProfile.Styles)
            {
                if (userStyle.ID == s.ID)
                {
                    hasStyle = true;
                    break;
                }
            }

            return hasStyle;
        }
        /// <summary>
        /// This JUST binds the data to the UserProfile model. 
        /// The only valdation it performs is specific to the interface and not the model
        /// </summary>
        /// <param name="bindingContext"></param>
        /// <returns></returns>
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            string prefix = string.Empty;
            if (bindingContext.FallbackToEmptyPrefix == false)
            {
                prefix = bindingContext.ModelName + ".";
            }

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

            userProfile.Forename = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Forename");
            userProfile.Surname = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Surname");
            userProfile.Profile = ModelBinderHelpers.GetValueAndUpdateModelState<string>(bindingContext, prefix + "Profile");

            ////Grab the style
            string[] styles = ModelBinderHelpers.GetValueAndUpdateModelState<string[]>(bindingContext, "Styles");

            userProfile.Styles = new List<ListenTo.Shared.DO.Style>();

            if (styles != null)
            {
                foreach (string styleId in styles)
                {
                    if (FormatHelpers.IsGuid(styleId))
                    {
                        ListenTo.Shared.DO.Style style = StyleManager.GetByID(new Guid(styleId));
                        userProfile.Styles.Add(style);
                    }
                }
            }

            return userProfile;
        }
Пример #4
0
 public string WhatsNewUrl(UserProfile userProfile)
 {
     return UrlHelper.RouteUrl(Routes.ACCOUNT_WHATS_NEW, new { username = userProfile.Username });
 }
Пример #5
0
 public string ViewUserProfileUrl(UserProfile userProfile)
 {
     return UrlHelper.RouteUrl(Routes.ACCOUNT_PROFILE, new { username = userProfile.Username });
 }
Пример #6
0
 public string ViewUserContent(UserProfile userProfile)
 {
     return UrlHelper.RouteUrl(Routes.ACCOUNT_USER_CONTENT, new { username = userProfile.Username });
 }
Пример #7
0
 public string EditUserProfileUrl(UserProfile userProfile)
 {
     return UrlHelper.RouteUrl(Routes.ACCOUNT_EDIT_PROFILE, new { id = userProfile.ID });
 }
Пример #8
0
 public static string WhatsNewUrl(this HtmlHelper helper, UserProfile userProfile)
 {
     return IOCHelper.GetRouteHelpers().WhatsNewUrl(userProfile);
 }
Пример #9
0
 public static string ViewUserContent(this HtmlHelper helper, UserProfile userProfile)
 {
     return IOCHelper.GetRouteHelpers().ViewUserContent(userProfile);
 }
Пример #10
0
 public static string EditUserProfileUrl(this HtmlHelper helper, UserProfile userProfile)
 {
     return IOCHelper.GetRouteHelpers().EditUserProfileUrl(userProfile);
 }
Пример #11
0
 public RedirectToRouteResult RedirectToWhoIs(UserProfile userprofile)
 {
     return RedirectToRoute(Routes.WHOIS_VIEW, new { username = userprofile.Username });
 }