public async Task Consume(ConsumeContext <ISignupRequested> context) { var mappedVal = context.Message.SignupStudent.Map(); var serviceResponse = await _signupService.SignupStudentToCourseAsync(mappedVal.Item1, mappedVal.Item2); await context.RespondAsync <ISignupProcessed>(new { Result = serviceResponse.Item1, Message = serviceResponse.Item2 }); // respond or send mail or use signalR. }
public async Task <IActionResult> PostSignup([FromRoute] long courseId, [FromBody] StudentSignUpWebModel student) { // validate request, use fluent validation or something var result = await _signupService.SignupStudentToCourseAsync(student.Map(courseId)); if (result.Item1) { return(Ok(result.Item2)); } else { return(StatusCode(StatusCodes.Status403Forbidden, result.Item2)); } }