diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app.md b/aspnetcore/blazor/tutorials/build-a-blazor-app.md index e0166aae8c..909b8c3f39 100644 --- a/aspnetcore/blazor/tutorials/build-a-blazor-app.md +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app.md @@ -419,31 +419,31 @@ The completed `Todo` component: :::moniker range=">= aspnetcore-8.0" -:::code language="razor" source="~/../blazor-samples/8.0/BlazorSample_WebAssembly/Pages/Todo.razor"::: +:::code language="razor" source="build-a-blazor-app/8.0/Todo8.razor"::: :::moniker-end :::moniker range=">= aspnetcore-7.0 < aspnetcore-8.0" -:::code language="razor" source="~/../blazor-samples/7.0/BlazorSample_WebAssembly/Pages/build-a-blazor-app/Todo.razor"::: +:::code language="razor" source="build-a-blazor-app/7.0/Todo8.razor"::: :::moniker-end :::moniker range=">= aspnetcore-6.0 < aspnetcore-7.0" -:::code language="razor" source="~/../blazor-samples/6.0/BlazorSample_WebAssembly/Pages/build-a-blazor-app/Todo.razor"::: +:::code language="razor" source="build-a-blazor-app/6.0/Todo8.razor"::: :::moniker-end :::moniker range=">= aspnetcore-5.0 < aspnetcore-6.0" -:::code language="razor" source="~/../blazor-samples/5.0/BlazorSample_WebAssembly/Pages/build-a-blazor-app/Todo.razor"::: +:::code language="razor" source="build-a-blazor-app/5.0/Todo8.razor"::: :::moniker-end :::moniker range="< aspnetcore-5.0" -:::code language="razor" source="~/../blazor-samples/3.1/BlazorSample_WebAssembly/Pages/build-a-blazor-app/Todo.razor"::: +:::code language="razor" source="build-a-blazor-app/3.1/Todo8.razor"::: :::moniker-end diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app/3.1/Todo8.razor b/aspnetcore/blazor/tutorials/build-a-blazor-app/3.1/Todo8.razor new file mode 100644 index 0000000000..2aa33ebbc8 --- /dev/null +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app/3.1/Todo8.razor @@ -0,0 +1,30 @@ +@page "/todo" + +

Todo (@todos.Count(todo => !todo.IsDone))

+ + + + + + +@code { + private List todos = new(); + private string? newTodo; + + private void AddTodo() + { + if (!string.IsNullOrWhiteSpace(newTodo)) + { + todos.Add(new TodoItem { Title = newTodo }); + newTodo = string.Empty; + } + } +} diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app/5.0/Todo8.razor b/aspnetcore/blazor/tutorials/build-a-blazor-app/5.0/Todo8.razor new file mode 100644 index 0000000000..2aa33ebbc8 --- /dev/null +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app/5.0/Todo8.razor @@ -0,0 +1,30 @@ +@page "/todo" + +

Todo (@todos.Count(todo => !todo.IsDone))

+ + + + + + +@code { + private List todos = new(); + private string? newTodo; + + private void AddTodo() + { + if (!string.IsNullOrWhiteSpace(newTodo)) + { + todos.Add(new TodoItem { Title = newTodo }); + newTodo = string.Empty; + } + } +} diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app/6.0/Todo8.razor b/aspnetcore/blazor/tutorials/build-a-blazor-app/6.0/Todo8.razor new file mode 100644 index 0000000000..1c2b26700a --- /dev/null +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app/6.0/Todo8.razor @@ -0,0 +1,32 @@ +@page "/todo" + +Todo + +

Todo (@todos.Count(todo => !todo.IsDone))

+ + + + + + +@code { + private List todos = new(); + private string? newTodo; + + private void AddTodo() + { + if (!string.IsNullOrWhiteSpace(newTodo)) + { + todos.Add(new TodoItem { Title = newTodo }); + newTodo = string.Empty; + } + } +} diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app/7.0/Todo8.razor b/aspnetcore/blazor/tutorials/build-a-blazor-app/7.0/Todo8.razor new file mode 100644 index 0000000000..1c2b26700a --- /dev/null +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app/7.0/Todo8.razor @@ -0,0 +1,32 @@ +@page "/todo" + +Todo + +

Todo (@todos.Count(todo => !todo.IsDone))

+ +
    + @foreach (var todo in todos) + { +
  • + + +
  • + } +
+ + + + +@code { + private List todos = new(); + private string? newTodo; + + private void AddTodo() + { + if (!string.IsNullOrWhiteSpace(newTodo)) + { + todos.Add(new TodoItem { Title = newTodo }); + newTodo = string.Empty; + } + } +} diff --git a/aspnetcore/blazor/tutorials/build-a-blazor-app/8.0/Todo8.razor b/aspnetcore/blazor/tutorials/build-a-blazor-app/8.0/Todo8.razor new file mode 100644 index 0000000000..cd9e167621 --- /dev/null +++ b/aspnetcore/blazor/tutorials/build-a-blazor-app/8.0/Todo8.razor @@ -0,0 +1,33 @@ +@page "/todo" +@rendermode InteractiveServer + +Todo + +

Todo (@todos.Count(todo => !todo.IsDone))

+ +
    + @foreach (var todo in todos) + { +
  • + + +
  • + } +
+ + + + +@code { + private List todos = new(); + private string? newTodo; + + private void AddTodo() + { + if (!string.IsNullOrWhiteSpace(newTodo)) + { + todos.Add(new TodoItem { Title = newTodo }); + newTodo = string.Empty; + } + } +}