Пример #1
0
        public async Task <ActionResult> SignUpMessageBus([FromBody] CourseSignUpModel model)
        {
            _logger.LogTrace("Post to SignUp/MessageBus");

            var student = await _studentService.FindById(model.StudentId);

            if (student == null)
            {
                _logger.LogWarn($"Sign Up MessageBus | Student not found {model.StudentId}");
                return(NotFound(new
                {
                    StatusCodes.Status404NotFound,
                    Message = "Student not found " + model.StudentId
                }));
            }
            ;

            await _serviceBusService.SendMessage(new { model.StudentId, model.CourseId, student.Email });

            _logger.LogInfo("Student sign up send to message bus successfully");

            return(CreatedAtAction(nameof(SignUpMessageBus), "Message Sent"));
        }