예제 #1
0
        public virtual bool ConfirmToken(string userName)
        {
            UserDBModel user = GetUser(userName);

            if (user == null)
            {
                return(false);
            }

            user.Confirmed = true;

            _portalDBContext.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            int changes = _portalDBContext.SaveChanges();

            return(changes > 0);
        }
예제 #2
0
        public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            using (PortalDBContext db = new PortalDBContext())
            {
                //Get the login information by user name
                Login login = db.Logins.SingleOrDefault(x => x.UserId.ToUpper().Equals(username.ToUpper()));

                if (login == null)
                {
                    return(false);
                }

                login.Password = newPassword;
                login.Status   = (int)LoginStatus.EXISTING;

                db.Logins.Attach(login);
                db.Entry(login).State = EntityState.Modified;
                db.SaveChanges();

                return(true);
            }
        }