public ActionResult PersistChosenAvatar(string avatarName) { ForumUserState forumUserState = stateRepository.GetForumUserState(); forumUserState.AvatarFileName = avatarName; forumUserState.PersistAvatar(forumUserState.RememberAvatar); return(RedirectToAction("Index", "Home")); }
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; } }
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")); }
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 }); }