Add chapter 12 blazor project

This commit is contained in:
Alvin Ashcraft
2023-08-27 14:35:28 -04:00
parent 7ba92b1abd
commit 48f651f395
34 changed files with 1411 additions and 0 deletions
@@ -0,0 +1,25 @@
@page "/tasks"
<h3>Tasks - (@taskList.Count(task => !task.IsComplete)) incomplete</h3>
<ul>
@foreach (var task in taskList)
{
<li>
<input type="checkbox" @bind="task.IsComplete" />
<input @bind="task.Name" />
</li>
}
</ul>
<input placeholder="Enter new task..." @bind="newTask" />
<button @onclick="AddTask">Add task</button>
@code {
private IList<TaskItem> taskList = new List<TaskItem>();
private string? newTask;
private void AddTask()
{
if (!string.IsNullOrWhiteSpace(newTask))
{
taskList.Add(new TaskItem { Name = newTask });
newTask = string.Empty;
}
}
}