Skip to content

Commit 417845c

Browse files
feat: adição do arquivo Index.razor
1 parent 4c88e07 commit 417845c

File tree

1 file changed

+44
-0
lines changed
  • developments/BlazorComponent/BlazorComponent/Components/Pages/Medicos

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@page "/medicos"
2+
3+
@rendermode InteractiveServer
4+
@inject IMedicoRepository repository
5+
@inject NavigationManager navigation
6+
7+
<CustomHeader>
8+
LISTAGEM DE MÉDICOS
9+
</CustomHeader>
10+
11+
<button class="btn btn-primary" @onclick="NovoMedico">NOVO MÉDICO</button>
12+
13+
<table class="table table-striped">
14+
<thead>
15+
<tr>
16+
<th>ID</th>
17+
<th>NOME</th>
18+
<th>CRM</th>
19+
<th>#</th>
20+
</tr>
21+
</thead>
22+
<tbody>
23+
<MedicoTemplateList Medicos="@Medicos" DeleteCallback="Delete" />
24+
</tbody>
25+
</table>
26+
27+
@code {
28+
public List<Medico>? Medicos;
29+
30+
protected override async Task OnInitializedAsync()
31+
{
32+
Medicos = await repository.GetAllAsync();
33+
}
34+
35+
public void Delete(Medico medico)
36+
{
37+
Medicos?.Remove(medico);
38+
}
39+
40+
public void NovoMedico()
41+
{
42+
navigation.NavigateTo("/medicos/create");
43+
}
44+
}

0 commit comments

Comments
 (0)