示例#1
0
 public ActionResult Reg(U_User user)
 {
     if (ModelState.IsValid)
     {
         using (var db = new TWEntities())
         {
             user.RegTime = DateTime.Now;
             user.PWD = GetMD5(user.PWD);
             db.U_User.Add(user);
             db.SaveChanges();
             return View();
         }
     }
     return View(user);
 }
示例#2
0
 public ActionResult DeleteUser(int id)
 {
     using (var db = new TWEntities())
     {
         var user = db.U_User.Find(id);
         if (user != null)
         {
             db.U_User.Remove(user);
             db.SaveChanges();
             return View();
         }
         else
         {
             return View();
         }
     }
 }