public async Task <IActionResult> Delete(int id) { var todoItem = await _todosService.GetTodoAsync(id); if (todoItem == null) { return(NotFound()); } var success = await _todosService.DeleteTodoAsync(id); if (success) { return(NoContent()); } else { return(StatusCode(500)); } }