Advertisement
Guest User

Untitled

a guest
Jul 16th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>@ViewBag.Title - Forum</title>
  6. <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  7. <meta name="viewport" content="width=device-width" />
  8. @Styles.Render("~/Content/css")
  9. @Scripts.Render("~/bundles/modernizr")
  10. </head>
  11. <body>
  12. <header>
  13. <div class="content-wrapper">
  14. <div class="float-left">
  15. <p class="site-title"> <img src="~/images/id_logo.png" /></p>
  16. </div>
  17. <div class="float-right">
  18. <section id="login">
  19. @Html.Partial("_LoginPartial")
  20. </section>
  21. <nav>
  22. <ul id="menu">
  23. <li>@Html.ActionLink("Home", "Index", "Home")</li>
  24. <li>@Html.ActionLink("Forums", "Index", "Forum")</li>
  25. <li>@Html.ActionLink("About", "About", "Home")</li>
  26. <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
  27. <li>@Html.ActionLink("Avatar", "SelectAvatar", "Avatar")</li>
  28. @Html.Action("Avatar", "Layout")
  29.  
  30. </ul>
  31. </nav>
  32. </div>
  33. </div>
  34. </header>
  35. <div id="body">
  36. @RenderSection("featured", required: false)
  37. <section class="content-wrapper main-content clear-fix">
  38. @RenderBody()
  39. </section>
  40. </div>
  41. <footer>
  42. <div class="content-wrapper">
  43. <div class="float-left">
  44. <p>&copy; @DateTime.Now.Year - ID</p>
  45.  
  46. </div>
  47. </div>
  48. </footer>
  49.  
  50. @Scripts.Render("~/bundles/jquery")
  51. @Scripts.Render("~/bundles/jqueryval")
  52. @RenderSection("scripts", required: false)
  53. </body>
  54. </html>
  55.  
  56. <!DOCTYPE html>
  57. <html>
  58. <head>
  59. <meta charset="utf-8" />
  60. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  61. <title>@ViewBag.Title - Forum</title>
  62. @Styles.Render("~/Content/css")
  63. @Scripts.Render("~/bundles/modernizr")
  64.  
  65.  
  66. </head>
  67. <body>
  68. <div class="navbar navbar-inverse navbar-fixed-top">
  69. <div class="container">
  70. <div class="navbar-header">
  71. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  72. <span class="icon-bar"></span>
  73. <span class="icon-bar"><</span>
  74. <span class="icon-bar"></span>
  75. </button>
  76.  
  77. @Html.Raw(@Html.ActionLink("[replacetext]", "Index", "Home",
  78. new { area = "" },
  79. new { @class = "navbar-brand" })
  80. .ToHtmlString().Replace("[replacetext]",
  81. "<img src="/images/forum.jpg" alt="QA Forum logo" />"))
  82.  
  83.  
  84. </div>
  85. <div class="navbar-collapse collapse ">
  86. <ul class="nav navbar-nav">
  87. <li>@Html.ActionLink("Home", "Index", "Home")</li>
  88. <li>@Html.ActionLink("Forums", "Index", "Forum")</li>
  89. <li>@Html.ActionLink("Threads", "Index", "Thread")</li>
  90. <li>@Html.ActionLink("Posts", "Index", "Post")</li>
  91. <li>@Html.ActionLink("About", "About", "Home")</li>
  92. <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
  93. <li>@Html.ActionLink("Avatar", "SelectAvatar", "Avatar")</li>
  94. <li>@Html.ActionLink("Admin", "Index", "Admin")</li>
  95. @Html.Action("Avatar", "Layout")
  96.  
  97. </ul>
  98. @Html.Partial("_LoginPartial")
  99.  
  100. </div>
  101. </div>
  102. </div>
  103. <div class="container body-content">
  104. @RenderBody()
  105. <hr />
  106. <footer>
  107. <p>&copy; @DateTime.Now.Year - ID</p>
  108. </footer>
  109. </div>
  110.  
  111. @Scripts.Render("~/bundles/jquery")
  112. @Scripts.Render("~/bundles/jqueryval")
  113. @Scripts.Render("~/bundles/bootstrap")
  114. @RenderSection("scripts", required: false)
  115. </body>
  116. </html>
  117.  
  118. using System;
  119. using System.Collections.Generic;
  120. using System.Linq;
  121. using System.Web;
  122. using System.Web.Mvc;
  123. using LbForum.Models;
  124. using LbForum.Resources;
  125.  
  126. namespace LbForum.Controllers
  127. {
  128. public class AvatarController : Controller
  129. {
  130. private IStateRepository stateRepository = null;
  131. public AvatarController()
  132. : this(new SessionStateRepository())
  133. {
  134.  
  135. }
  136.  
  137. public AvatarController(IStateRepository sessionStateRepository)
  138. {
  139. this.stateRepository = sessionStateRepository;
  140. }
  141.  
  142. //
  143. // GET: /Avatar/
  144.  
  145. public ActionResult SelectAvatar()
  146. {
  147. var avatarUtilities = new AvatarUtilities();
  148. ViewBag.AvatarList = avatarUtilities.GetAllAvatars();
  149. ViewBag.RememberAvatar = stateRepository.GetForumUserState().RememberAvatar;
  150. return View();
  151. }
  152.  
  153. public ActionResult PersistChosenAvatar(string avatarName)
  154. {
  155. ForumUserState forumUserState = stateRepository.GetForumUserState();
  156. forumUserState.AvatarFileName = avatarName;
  157. forumUserState.PersistAvatar(forumUserState.RememberAvatar);
  158. return RedirectToAction("Index", "Home");
  159. }
  160.  
  161. public ActionResult RememberAvatar(bool chkRemember)
  162. {
  163. ForumUserState forumUserState = stateRepository.GetForumUserState();
  164. // button logic true keeps avatar data in cookie false doesn't
  165. if (chkRemember == true)
  166. {
  167. forumUserState.RememberAvatar = true;
  168. forumUserState.PersistAvatar(true);
  169. }
  170. else
  171. {
  172. forumUserState.RememberAvatar = false;
  173. forumUserState.PersistAvatar(false);
  174. }
  175. return RedirectToAction("SelectAvatar", "Avatar");
  176. }
  177.  
  178. }
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement