private async Task SendDepartmentManagerEmail(EvaluationResponseDto evaluationResponseDto) { // get the DM email var departmentManager = _userService.FindBy(u => u.Id == evaluationResponseDto.DepartmentManagerId).FirstOrDefault(); var evaluationId = evaluationResponseDto.EvaluationId; var link = $"http://localhost:63585/Evaluations/ShowResponse/{evaluationId}?employeeId={departmentManager.Id}"; await _emailSender.SendEmailAsync(departmentManager.Email, "Employees Evaluation", $"Hi {departmentManager.Email}, <br /> A new evaluation has been answered.<br /><br /> <a href='{link}' target='_blank'>Check it now!</a>"); }
public async Task <IActionResult> SaveReply(EvaluationResponseDto evaluationResponseDto, IFormFile File) { _logger.LogInformation("---------------- " + evaluationResponseDto); await UploadAnswersFile(evaluationResponseDto.QuestionAnswers); var evaluationResponse = Mapper.Map <EvaluationResponseDto, EvaluationResponse>(evaluationResponseDto); _evaluationService.CreateEvaluationResponse(evaluationResponse); await SendDepartmentManagerEmail(evaluationResponseDto); TempData["messageType"] = "toast-success"; TempData["messageText"] = "Evaluation has been successfully answered!"; return(RedirectToAction("Responses", "Evaluations")); }
public IActionResult Reply(int id, string employeeId, string departmentManagerId) { var evaluation = _evaluationService.GetEvaluationAssigned(id, employeeId); var evaluationDto = Mapper.Map <Evaluation, EvaluationDto>(evaluation); var evaluationResopnseDto = new EvaluationResponseDto(); evaluationResopnseDto.Evaluation = evaluationDto; evaluationResopnseDto.EvaluationId = id; evaluationResopnseDto.EmployeeId = employeeId; evaluationResopnseDto.DepartmentManagerId = departmentManagerId; if (evaluation == null) { _logger.LogInformation("--------------- This Employee Has No Evaluation To Answer "); } else { // verify if this evaluation has already been answered } return(View(evaluationResopnseDto)); }