@using Oqtane.Modules.Controls @using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Models @namespace SZUAbsolventenverein.Module.EventRegistration @inherits ModuleBase @inject IEventRegistrationService EventRegistrationService @inject NavigationManager NavigationManager @inject IStringLocalizer Localizer

Anmeldung zum Event

Willst du am Event (@_name) teilnehmen?

@_eventDate - @_location

@_description

@if (PageState.User != null) { @if (Status != null) {

Status: @if (Status == true) { @Localizer["Zusage"] } else { @Localizer["Absage"] }

} else {
} } else {

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

} @code { public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View; public override string Actions => "Details"; public override string Title => "Event Details"; public override List Resources => new List() { new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } }; private ElementReference form; private bool validated = false; private int _id; private string _name; private string _description; private DateTime _eventDate; private string _location; private string _createdby; private DateTime _createdon; private string _modifiedby; private DateTime _modifiedon; private Response _response; private bool? Status; private async Task SendResponse(bool response) { if(_response == null) { _response = new Response(); _response.EventRegistrationId = _id; _response.OwnerId = PageState.User.UserId; _response.ModuleId = ModuleState.ModuleId; _response.ResponseType = response; _response = await EventRegistrationService.AddResponseAsync(_response); } else { _response.ResponseType = response; _response = await EventRegistrationService.UpdateResponseAsync(_response); } if(_response != null) Status = _response.ResponseType; } private async void Zusage() { await SendResponse(true); } private async void Absage() { await SendResponse(false); } protected override async Task OnInitializedAsync() { try { _id = Int32.Parse(PageState.QueryString["id"]); Event currentEvent; Response rsvp; (currentEvent, rsvp) = await EventRegistrationService.GetEventDetails(_id, ModuleState.ModuleId); if (currentEvent != null) { _name = currentEvent.Name; _description = currentEvent.Description; _eventDate = currentEvent.EventDate.ToLocalTime(); _location = currentEvent.Location; _createdby = currentEvent.CreatedBy; _createdon = currentEvent.CreatedOn.ToLocalTime(); _modifiedby = currentEvent.ModifiedBy; _modifiedon = currentEvent.ModifiedOn.ToLocalTime(); } if(rsvp != null) { _response = rsvp; Status = rsvp.ResponseType; } } catch (Exception ex) { await logger.LogError(ex, "Error Loading EventRegistration {EventRegistrationId} {Error}", _id, ex.Message); AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); } } }