public async Task <IActionResult> AddItem(string text, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(text)) { return(BadRequest()); } await _service.AddItemAsync(text, cancellationToken); return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult <Todo> > PostTodo(Todo todo) { await todoService.AddItemAsync(todo); return(CreatedAtAction("GetTodo", new { id = todo.Id }, todo)); }