Exemplo n.º 1
0
        // Get: Change Name
        public ActionResult ChangeName()
        {
            //Find the Login user string
            var userId = User.Identity.GetUserId();
            //Goes to the User table and Find the userId that matches
            var user = db.Users.Find(userId);

            var ChangeName = new ChangeNameView();

            ChangeName.FirstName = user.FirstName;
            ChangeName.LastName  = user.LastName;
            return(View(ChangeName));
        }
Exemplo n.º 2
0
        public ActionResult ChangeName(ChangeNameView model)
        {
            //Find the Login user string
            var userId = User.Identity.GetUserId();
            //Goes to the User table and Find the userId that matches
            var user = db.Users.Find(userId);

            user.FirstName = model.FirstName;
            user.LastName  = model.LastName;
            user.FullName  = model.FirstName + " " + model.LastName;
            db.SaveChanges();


            return(RedirectToAction("Index"));
        }