79 lines
2.8 KiB
Plaintext
79 lines
2.8 KiB
Plaintext
@using SZUAbsolventenverein.Module.BlackBoard.Services
|
|
@using SZUAbsolventenverein.Module.BlackBoard.Models
|
|
|
|
@namespace SZUAbsolventenverein.Module.BlackBoard
|
|
@inherits ModuleBase
|
|
@inject IBlackBoardService BlackBoardService
|
|
@inject NavigationManager NavigationManager
|
|
@inject IStringLocalizer<Index> Localizer
|
|
|
|
@if (_BlackBoards == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add BlackBoard" ResourceKey="Add" />
|
|
<br />
|
|
<br />
|
|
@if (@_BlackBoards.Count != 0)
|
|
{
|
|
<Pager Items="@_BlackBoards">
|
|
<Header>
|
|
<th style="width: 1px;"> </th>
|
|
<th style="width: 1px;"> </th>
|
|
<th>@Localizer["Name"]</th>
|
|
</Header>
|
|
<Row>
|
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.BlackBoardId.ToString())" ResourceKey="Edit" /></td>
|
|
<td><ActionDialog Header="Delete BlackBoard" Message="Are You Sure You Wish To Delete This BlackBoard?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.BlackBoardId.ToString()" /></td>
|
|
<td>@context.Name</td>
|
|
</Row>
|
|
</Pager>
|
|
}
|
|
else
|
|
{
|
|
<p>@Localizer["Message.DisplayNone"]</p>
|
|
}
|
|
}
|
|
|
|
@code {
|
|
public override string RenderMode => RenderModes.Static;
|
|
|
|
public override List<Resource> Resources => new List<Resource>()
|
|
{
|
|
new Stylesheet("_content/SZUAbsolventenverein.Module.BlackBoard/Module.css"),
|
|
new Script("_content/SZUAbsolventenverein.Module.BlackBoard/Module.js")
|
|
};
|
|
|
|
List<BlackBoard> _BlackBoards;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_BlackBoards = await BlackBoardService.GetBlackBoardsAsync(ModuleState.ModuleId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Loading BlackBoard {Error}", ex.Message);
|
|
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
|
|
}
|
|
}
|
|
|
|
private async Task Delete(BlackBoard BlackBoard)
|
|
{
|
|
try
|
|
{
|
|
await BlackBoardService.DeleteBlackBoardAsync(BlackBoard.BlackBoardId, ModuleState.ModuleId);
|
|
await logger.LogInformation("BlackBoard Deleted {BlackBoard}", BlackBoard);
|
|
_BlackBoards = await BlackBoardService.GetBlackBoardsAsync(ModuleState.ModuleId);
|
|
StateHasChanged();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Deleting BlackBoard {BlackBoard} {Error}", BlackBoard, ex.Message);
|
|
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
|
|
}
|
|
}
|
|
} |