Created
May 14, 2018 16:59
-
-
Save vmussak/562a80ddd1c065aca81c1cb65b428aaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/lista-de-tarefas" | |
<h1>Lista de tarefas (@tarefas.Where(tarefa => !tarefa.Completa).Count())</h1> | |
<ul> | |
@foreach(var tarefa in tarefas) | |
{ | |
<li> | |
<input type="checkbox" @bind(tarefa.Completa) /> | |
<input type="text" @bind(tarefa.Titulo) /> | |
</li> | |
} | |
</ul> | |
<input placeholder="Alguma coisa para fazer..." @bind(novaTarefa) /> | |
<button @onclick(AdicionarTarefa)>Adicionar tarefa</button> | |
@functions { | |
IList<TarefaModel> tarefas = new List<TarefaModel>(); | |
string novaTarefa; | |
void AdicionarTarefa() | |
{ | |
if(!string.IsNullOrWhiteSpace(novaTarefa)) | |
{ | |
tarefas.Add(new TarefaModel { Titulo = novaTarefa }); | |
novaTarefa = string.Empty; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment