Add project files.
This commit is contained in:
@ -0,0 +1,96 @@
|
||||
@using SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
@using SZUAbsolventenverein.Module.EventRegistration.Models
|
||||
|
||||
@namespace SZUAbsolventenverein.Module.EventRegistration
|
||||
@inherits ModuleBase
|
||||
@inject IEventRegistrationService EventRegistrationService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_EventRegistrations == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add Event" ResourceKey="Add" />
|
||||
<br />
|
||||
<br />
|
||||
<p>@Status</p>
|
||||
@if (@_EventRegistrations.Count != 0)
|
||||
{
|
||||
<Pager Items="@_EventRegistrations">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th style="width: 1px;"> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.EventRegistrationId.ToString())" ResourceKey="Edit" /></td>
|
||||
<td><ActionDialog Header="Delete EventRegistration" Message="Are You Sure You Wish To Delete This EventRegistration?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.EventRegistrationId.ToString()" /></td>
|
||||
<td>@context.Name</td>
|
||||
|
||||
@* @if(UserSecurity.IsAuthorized(PageState.User, PermissionNames.Utilize)) { *@
|
||||
<td><ActionLink Action="Details" Parameters="@($"id=" + context.EventRegistrationId.ToString())" ResourceKey="Details"/></td>
|
||||
@* } *@
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>@Localizer["Message.DisplayNone"]</p>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
private string Status;
|
||||
|
||||
public override List<Resource> Resources => new List<Resource>()
|
||||
{
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
|
||||
new Resource { ResourceType = ResourceType.Script, Url = ModulePath() + "Module.js" }
|
||||
};
|
||||
|
||||
List<Event> _EventRegistrations;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading EventRegistration {Error}", ex.Message);
|
||||
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Delete(Event EventRegistration)
|
||||
{
|
||||
try
|
||||
{
|
||||
await EventRegistrationService.DeleteEventRegistrationAsync(EventRegistration.EventRegistrationId, ModuleState.ModuleId);
|
||||
await logger.LogInformation("EventRegistration Deleted {EventRegistration}", EventRegistration);
|
||||
_EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting EventRegistration {EventRegistration} {Error}", EventRegistration, ex.Message);
|
||||
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Accept(Event eventRegistration)
|
||||
{
|
||||
Status = ("EventRegistration Accepted " + eventRegistration.Name);
|
||||
await logger.LogInformation("EventRegistration Accepted {EventRegistration}", eventRegistration);
|
||||
}
|
||||
|
||||
private void Reject()
|
||||
{
|
||||
Status = "EventRegistration Rejected 1";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user