@using Microsoft.AspNetCore.Authorization
@attribute [Authorize]
@using WorkManagementTool.Services
@using WorkManagementTool.Data.Entities
@inject HomeworkService HomeworkService

<button class="btn btn-danger">-</button>

@code {
    [Parameter]
    public int HomeworkId { get; set; }

    [Parameter]
    public EventCallback<int> OnDeleted { get; set; }

    private async Task Delete(MouseEventArgs e)
    {
        await HomeworkService.DeleteHomeworkAsync(HomeworkId);
        await OnDeleted.InvokeAsync(HomeworkId);
    }
}
