Esempio n. 1
0
        public ActionResult PersistChosenAvatar(string avatarName)
        {
            ForumUserState forumUserState = stateRepository.GetForumUserState();

            forumUserState.AvatarFileName = avatarName;

            forumUserState.PersistAvatar(forumUserState.RememberAvatar);

            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 2
0
        protected void Session_Start()
        {
            System.Web.HttpCookie c = Request.Cookies["AvatarFileName"];

            if (c != null)
            {
                IStateRepository stateRepository = new SessionStaterepository();

                ForumUserState forumUserState = stateRepository.GetForumUserState();

                forumUserState.AvatarFileName = c.Value;
                forumUserState.RememberAvatar = true;
            }
        }
Esempio n. 3
0
        public ActionResult RememberAvatar(bool chkRemember)
        {
            ForumUserState forumUserState = stateRepository.GetForumUserState();

            if (chkRemember == true)
            {
                forumUserState.RememberAvatar = true;
                forumUserState.PersistAvatar(true);
            }
            else
            {
                forumUserState.RememberAvatar = false;
                forumUserState.PersistAvatar(false);
            }

            return(RedirectToAction("SelectAvatar", "Avatar"));
        }
Esempio n. 4
0
        public ContentResult Avatar()
        {
            string imgPath = "~/content/images/avatars/";

            ForumUserState forumUserState = stateRepository.GetForumUserState();

            if (forumUserState.AvatarFileName != string.Empty)
            {
                imgPath += forumUserState.AvatarFileName;
            }
            else
            {
                imgPath += "avatar1.jpg";
            }

            return(new ContentResult()
            {
                Content = imgPath
            });
        }