public IHttpResponse SessionTest(IHttpRequest request) { IHttpSession session = request.Session; if (session.GetParameter("Logged_in") == null) { session.Add("Logged_in", DateTime.UtcNow); } DateTime loggedInTime = (DateTime)session.GetParameter("Logged_in"); var response = new ViewResponse(HttpStatusCode.OK, new SessionTestView(loggedInTime)); return(response); }
public IHttpResponse Details(IHttpRequest request) { IHttpSession session = request.Session; if (session.Containts(SessionKeys.CurrentUser)) { this.ShowUserNavBar(session.GetParameter(SessionKeys.CurrentUser).ToString()); } else { this.ShowGuestNavBar(); } int gameId = int.Parse(request.UrlParameters["id"]); GameDetailsViewModel model = this.GameService.Details(gameId); this.ViewData["gameId"] = gameId.ToString(); this.ViewData["gameTitle"] = model.Title; this.ViewData["gameTrailer"] = model.Trailer; this.ViewData["gameDescription"] = model.Description; this.ViewData["gamePrice"] = model.Price.ToString("F2"); this.ViewData["gameSize"] = model.Size.ToString("F1"); this.ViewData["gameReleaseDate"] = model.ReleaseDate.ToString("dd/MM/yyyy"); return(this.FileViewResponse(@"game\details")); }
protected string[] GetCurrentSessionUserIdandName(IHttpRequest request) { string[] result = null; IHttpSession session = GetCurrentSession(request); if (session.ContainsParameter(userInfo)) { result = (string[])session.GetParameter(userInfo); } return(result); }
public IHttpResponse Index(IHttpSession session) { if (session.Containts(SessionKeys.CurrentUser)) { string currentUserEmail = session .GetParameter(SessionKeys.CurrentUser) .ToString(); this.ShowUserNavBar(currentUserEmail); } else { this.ShowGuestNavBar(); } return(this.FileViewResponse(FilePaths.HomeIndex)); }