예제 #1
0
        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));
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        // 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));
        }