コード例 #1
0
 public async Task <ActionResult <Person> > SignupQueued(int courseId, SignupModel signup, [FromServices] IEventQueue <Signup.Command> queue)
 {
     return(await queue.Enqueue(signup.ToSignupRequest(courseId)) ? new OkResult() : new StatusCodeResult(500));
 }
コード例 #2
0
        public async Task <ActionResult <Person> > SignupBlocking(int courseId, SignupModel signup, [FromServices] IRequestHandler <Signup.Command, Result <Person, ValidationError> > handler)
        {
            var result = await handler.Handle(signup.ToSignupRequest(courseId));

            return(result.IsOk ? new OkObjectResult(result.Value()) : Web.ValidationProblem(result.Errors()));
        }