public IActionResult AddTeacher(AddTeacherVm model) { if (!ModelState.IsValid) { return(View(model)); } _messages.Dispatch(new TeacherRegistrationCommand(_secureTokenGenerator.Generate(20), model.Email)); return(RedirectToAction("Teachers")); }
public IActionResult SendRegistrationInvite(int studentId) { var student = _messages.Dispatch(new GetStudentQuery(studentId)); if (student == null) { return(new NotFoundResult()); } var studentInviteCommand = new StudentInviteCommand(_secureTokenGenerator.Generate(20), student); _messages.Dispatch(studentInviteCommand); TempData["message"] = "Kutse edukalt saadetud"; return(RedirectToAction("FindStudent", "Admin", new { name = student.Name })); }