Untitled

 avatar
unknown
plain_text
2 years ago
1.6 kB
9
Indexable
@inject IAdminService AdminService
<h3>@Navigation</h3>

@if (Alert != string.Empty)
{
    <div class="d-flex">
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            <strong>@Alert</strong>
            <button type="button" @onclick="CloseAlert" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    </div>
}
<div class="d-flex me-1">
    <a href="/" class="btn btn-outline-secondary rounded-0 me-1">Home</a>
    <button type="button" class="btn btn-outline-primary rounded-0 me-1" @onclick="()=>ChangePageType(PageType.Index)">Index</button>
    <button type="button" class="btn btn-outline-success rounded-0" @onclick="()=>ChangePageType(PageType.Create)">Create</button>
</div>


@*<FilmsIndex OnClick="OnClick" Model="Model"></FilmsIndex>*@


@code {
    List<FilmDTO> Model { get; set; } = new();
    string Alert = string.Empty;
    string Navigation = string.Empty;
    void ChangePageType(string pageType) =>
    Navigation = pageType;
    void CloseAlert() => Alert = string.Empty;

    //List<FilmDTO> Model { get; set; } = new();
    protected override async Task OnInitializedAsync()
    {
        Alert = string.Empty;
        Model = await AdminService.GetAsync<FilmDTO>($"Films?freeonly=true");

        //await AdminService.CreateAsync<FilmDTO>($"Films", new FilmDTO(){Id = 5, Description = "sadasdad"} );
        //await AdminService.EditAsync<FilmDTO>($"Films/1", new FilmDTO());
        //Alert = "Test message";//string.Empty;
    }
Editor is loading...