public ActionResult ChangeUsername(MVCPAP.Models.User user) { ViewBag.title = "Change Username"; if (Session["userId"] == null) { return(RedirectToAction("NotFound", "Home", new { id = "User not logged in" })); } user.username = Session["userId"].ToString().Split('-')[1]; user.discriminator = int.Parse(Session["userId"].ToString().Split('-')[0]); return(View(user)); }
public ActionResult Signin(MVCPAP.Models.User loginUser) { UserBll Bll = new UserBll(); loginUser = Bll.SignInUser(loginUser); if (loginUser.Valid) { Session["userId"] = loginUser.discriminator + "-" + loginUser.username; return(RedirectToAction("Index", "Home")); } else { return(View("SigninPage", loginUser)); } }
public ActionResult Autherize(MVCPAP.Models.User loginUser) { UserBll Bll = new UserBll(); loginUser = Bll.LogInUser(loginUser); if (loginUser.Valid) { Session["userId"] = loginUser.discriminator + "-" + loginUser.username; return(RedirectToAction("Return", "Home", new { id = "" })); } else { return(View("LoginPage", loginUser)); } }
// GET: Account public ActionResult Index() { if (Session["userId"] is null) { return(RedirectToAction("NotFound", "Home", new { id = "User not logged in" })); } UserBll userBll = new UserBll(); MVCPAP.Models.User user = userBll.GetUserById(Session["userId"].ToString()); VideoBll videoBll = new VideoBll(); ViewBag.videos = videoBll.GetVideosByUserId(Session["userId"].ToString()); return(View(user)); }