@page "/todo"

<h3>To-do list</h3>
<p>List of tasks that must be done for server management.</p>
<hr/>
<br/>
<button type="button" class="btn btn-primary" @onclick="AddTask">Add Task</button>
<br/>
<br/>
@if (items != null && items.Count > 0)
{
  <ul class="list-unstyled">
    <ToDoItemListComponent Items="items"></ToDoItemListComponent>
  </ul>
}


@code {
  private List<ToDoItem> items = ToDoItemsRepository.GetItems();
  private void AddTask()
  {
    ToDoItemsRepository.AddItem(new ToDoItem { Name = "New Task"} );
    items = ToDoItemsRepository.GetItems();
  }
}