示例#1
0
        public ActionResult ChangeDisplayName(Entities.Models.Profile.ChangeDisplayName model)
        {
            if (ModelState.IsValid)
            {
                int    currentUserId      = Authentication.Security.CurrentUserId;
                String currentDisplayName = Authentication.Security.CurrentUserName;

                Entities.OAMembership memberShipData = null;

                if (!Authentication.Security.UserExists(model.DisplayName))
                {
                    memberShipData = _updateUser.Execute(currentUserId, model.DisplayName, currentDisplayName);
                }

                if (memberShipData != null)
                {
                    Authentication.Security.Logout();
                    Authentication.OAuthSecurity.Login(memberShipData.Provider, memberShipData.ProviderUserId, false);
                    return(Redirect(string.Format("/Profile/{0}", currentUserId)));
                }
                else if (model.DisplayName == currentDisplayName)
                {
                    return(Redirect(string.Format("/Profile/{0}", currentUserId)));
                }
                else
                {
                    ModelState.AddModelError("DisplayName", "Display name already exists. Please enter a different display name.");
                }
            }

            return(View(model));
        }
示例#2
0
        public ActionResult ChangeDisplayName()
        {
            Entities.Models.Profile.ChangeDisplayName model = new Entities.Models.Profile.ChangeDisplayName();
            model.DisplayName = Authentication.Security.CurrentUserName;

            return(View(model));
        }
示例#3
0
        public ActionResult ChangeDisplayName()
        {
            Entities.Models.Profile.ChangeDisplayName model = new Entities.Models.Profile.ChangeDisplayName();
            model.DisplayName = Authentication.Security.CurrentUserName;

            return View(model);
        }