public IActionResult ForgotPassword(ForgotPasswordVM forgotPasswordVM) { var Email = forgotPasswordVM.Email; var Get = employeeRepository.GetAll(); var CheckLogin = Get.FirstOrDefault(e => e.Email == forgotPasswordVM.Email); if (CheckLogin != null) { Guid newPassword = Guid.NewGuid(); Account account = new Account { NIK = CheckLogin.NIK, Password = newPassword.ToString("N").Substring(0, 8) }; accountRepository.ChangePassword(CheckLogin.NIK, account.Password); SendEmailService.GantiPassword(Email, account.Password); return(Ok(new { status = HttpStatusCode.OK, message = "New Password Sent" })); } else { return(NotFound(new { status = HttpStatusCode.NotFound, message = "No account has this email" })); } }