Beispiel #1
0
 public RedirectToRouteResult InsertUser(User user)
 {
     user.Password = EncryptUtil.Md5Hash(user.Password);
     user.Active   = true;
     user.Joined   = DateTime.Now;
     _db.Users.Add(user);
     _db.SaveChanges();
     return(RedirectToAction("Home", "UserHome", user));
 }
        public bool UpdateUser(User usr)
        {
            var selUsr = _db.Users.Single(x => x.ID == usr.ID);

            if (selUsr != null)
            {
                selUsr.Password = usr.Password;
                selUsr.Email    = usr.Email;
                _db.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }