public async Task <IActionResult> RegisterExam(RegisterExamRequestParam param) { try { var result = await _registerExamService.RegisterExam(param.SemesterId, param.ExamId, param.ListSubjectInExam, param.EmployeeId); if (result) { var listEmp = await _employeeService.GetAsync(); foreach (var emp in listEmp) { string title = "Register Exam Group"; string body = "Hi " + emp.Email + " You got a schedule to register ."; await _fcmService.SendMessage(emp.Id, title, body); } } return(Ok(result)); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public async Task <ActionResult <CommonRecruitmentPostDataset> > CreatePost([FromBody] NewRecruitmentPostParam param) { int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); if (userId != param.CompanyId) { return(Forbid()); } CommonRecruitmentPostDataset result = await _recruitmentService.InsertRecruitmentPost(param); if (result != null) { await _fcmService.SendMessage(userId, "Creating post succeed", "Recruitment post " + result.Title + " has created."); return(Created("", result)); } else { await _fcmService.SendMessage(userId, "Creating post failed", "Creating recruitment post failed."); } return(BadRequest()); }
public async Task <IActionResult> SchedulingEmployee([FromRoute] int examId, int adminId) { try { var result = await _schedulingService.ScheduleEmployee(examId, adminId); if (result) { var listEmp = await _employeeService.GetAsync(); foreach (var emp in listEmp) { string title = "Register Success"; string body = "Hi " + emp.Email + " Your schedule is registerd."; await _fcmService.SendMessage(emp.Id, title, body); } } return(Ok(result)); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }