public bool UpdateUserPassword(string id, string newPassword) { if (CheckUserNewPassword(id, newPassword)) { int mod4 = id.Length % 4; if (mod4 > 0) { id += new string('=', 4 - mod4); } var userId = Convert.ToInt32(ConvertString.MD5Decode(id)); var currentClient = _context.Users.Find(userId); if (currentClient.Id == userId) { currentClient.Password = newPassword; _context.SaveChanges(); _notificationsService.SendPasswordChangeNotification(currentClient); return(true); } else { return(false); } } else { return(false); } }