public IActionResult Post(NewTodoItem request)
        {
            if (request == null || request.Title == string.Empty)
            {
                return(BadRequest("All parameters are required."));
            }

            var item = _todoItemsCommandHandler.Handle(new CreateTodoItemCommand()
            {
                Title = request.Title,
            });

            return(Ok(item));
        }
Exemple #2
0
        public IActionResult PostTodoItem(NewTodoItemDto todoItem)
        {
            _commandHandler.Handle(new AddTodoItem {
                TodoItem = todoItem
            });

            return(new CreatedResult(string.Empty, todoItem));
        }