public bool UpdateUserPassword(int userId, UserPasswordsDTO passwords) { bool result = false; ISession session = null; try { session = DataLayer.GetSession(); User user = session.Load <User>(userId); if (user.Password != passwords.OldPassword) { throw new Exception("WrongPassword"); } user.Password = passwords.NewPassword; session.SaveOrUpdate(user); session.Flush(); session.Close(); result = true; } catch (Exception ex) { Console.WriteLine(ex.Message); if (session != null) { session.Close(); } } return(result); }
public bool UpdateUserPassword(int id, UserPasswordsDTO passwords) { return(userDataAccess.UpdateUserPassword(id, passwords)); }
public bool Put(int id, [FromBody] UserPasswordsDTO passwords) { service = Service.UserService; return(service.UpdateUserPassword(id, passwords)); }