Example #1
0
        public async Task <TodoItem> Post(
            [FromBody] CreateTodoRequest request,
            [FromServices] CreateTodoHandler handler)
        {
            var result = await handler.HandleAsync(request);

            return(result);
        }
        public async Task <IActionResult> OnPostAsync(
            [FromServices] CreateTodoHandler handler)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await handler.HandleAsync(Input);

            return(RedirectToPage("/Index"));
        }
 private async Task Act(CreateTodo command) => await _commandHandler.HandleAsync(command, _context);