Ejemplo n.º 1
0
        public ActionResult EditUser([Bind(Include = "userId,BirthDate,FullName,Gender")] EditViewModel editUser)
        {
            if (ModelState.IsValid)
            {
                pi_12Entities db   = new pi_12Entities();
                var           user = db.AspNetUsers.Find(editUser.userId);
                if (user == null)
                {
                    return(HttpNotFound());
                }
                if (editUser.userId == user.Id)
                {
                    user.BirthDate = editUser.BirthDate;
                    user.FullName  = editUser.FullName;
                    user.Gender    = editUser.Gender;

                    db.Entry(user).State = EntityState.Modified;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(editUser));
        }