@page "/CadastrarMusica"
@inject ArtistaApi artistaApi
@inject GeneroAPI generoAPI
<MudPaper Class="px-8 pt-2 pb-4 mx-12 my-8" Justify="Justify.Center">
<MudText Class="mt-8" Typo="Typo.h4">Cadastro de Música</MudText>
<MudForm>
<MudTextField Class="mt-4" T="string" Placeholder="Nome da música/canção"
@bind-Value="nome"
Variant="Variant.Outlined"
Required="true"
RequiredError="Campo obrigatório." />
<MudSelect Class="mt-4" T="ArtistaResponse" Label="Artistas" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
@if (artistas is not null)
{
@foreach (var artista in artistas)
{
<MudSelectItem Value="artista" />
}
}
</MudSelect>
<MudTextField Class="mt-4" Placeholder="Ano de lançamento"
@bind-Value="anoLancamento"
Variant="Variant.Outlined"
Lines="1"
Required="true"
RequiredError="Campo obrigatório." />
<MudSelect Class="mt-4" T="GeneroResponse" Label="Gêneros" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
@if (generos is not null)
{
@foreach (var generos in generos)
{
<MudSelectItem Value="generos" />
}
}
</MudSelect>
<div class="d-flex align-center justify-space-between mt-4">
<MudButton Variant="Variant.Filled"
Color="Color.Primary"
Class="ml-auto">
Cadastrar
</MudButton>
<MudButton Variant="Variant.Filled"
Color="Color.Info"
Class="ml-3">
Voltar
</MudButton>
</div>
</MudForm>
</MudPaper>
@code {
private int anoLancamento;
private string? nome;
private ICollection<ArtistaResponse>? artistas;
private ICollection<GeneroResponse>? generos;
protected override async Task OnInitializedAsync()
{
artistas = await artistaApi.GetArtistasAsync();
generos = await generoAPI.GetGenerosAsync();
}
}