示例#1
0
 public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         user.Password = Code.Tool.SHA256Encrypt(user.Password);
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(user);
 }
示例#2
0
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                user.Password = Code.Tool.SHA256Encrypt(user.Password);
                db.Users.Add(user);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(user);
        }