Пример #1
0
        public void UpdatePasswordUser(NewPasswordDTO item)
        {
            UsersRepository repository = new UsersRepository();
            var             userId     = repository.GetItem(item.Id);

            if (userId != null && item.New_Password.CompareTo(item.Confirm_Password) == 0)
            {
                userId.Password = item.Confirm_Password;
                repository.Update(userId.Id, userId);
            }
            else
            {
                throw new Exception("Passwords do not match.");
            }
        }
Пример #2
0
        public IActionResult NewPassword([FromBody] NewPasswordDTO item)
        {
            try
            {
                UserService userservice = new UserService();

                userservice.UpdatePasswordUser(item);


                return(Ok());
            }
            catch (Exception e)
            {
                throw e;
            }
        }