示例#1
0
        public bool ChangePassword(Guid userId, PasswordEntity passwordEntity)
        {
            string oldPassword = GetHashString(passwordEntity.OldPassword);
            User   User        = IMSContext.Users.Where(u => u.Id.Equals(userId)).FirstOrDefault();

            if (User == null)
            {
                return(false);
            }
            if (oldPassword.Equals(User.Password))
            {
                passwordEntity.UserEntity.ToModel(User);
                User.Password = GetHashString(passwordEntity.UserEntity.Password);
                IMSContext.SaveChanges();
                return(true);
            }
            return(false);
        }
示例#2
0
 public bool ChangePassword(Guid UserId, [FromBody] PasswordEntity PasswordEntity)
 {
     return(UserService.ChangePassword(UserId, PasswordEntity));
 }