Event: Add description, date and location.
Changed Files: Model >Event.cs & Client > Module > Edit.razor & Detail.razor
This commit is contained in:
@ -11,6 +11,12 @@
|
||||
<h3>Anmeldung zum Event</h3>
|
||||
|
||||
<p>Willst du am Event (@_name) teilnehmen?</p>
|
||||
<span>@_eventDate - @_location</span>
|
||||
<div>
|
||||
<p>@_description</p>
|
||||
<p><strong>Erstellt von:</strong> @_createdby am @_createdon</p>
|
||||
<p><strong>Zuletzt aktualisiert von:</strong> @_modifiedby am @_modifiedon</p>
|
||||
</div>
|
||||
|
||||
@if (PageState.User != null) {
|
||||
|
||||
@ -35,7 +41,7 @@
|
||||
}
|
||||
} else
|
||||
{
|
||||
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login />
|
||||
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login /><Register />
|
||||
}
|
||||
|
||||
@code {
|
||||
@ -55,6 +61,10 @@
|
||||
|
||||
private int _id;
|
||||
private string _name;
|
||||
private string _description;
|
||||
private DateTime _eventDate;
|
||||
private string _location;
|
||||
|
||||
private string _createdby;
|
||||
private DateTime _createdon;
|
||||
private string _modifiedby;
|
||||
@ -103,6 +113,9 @@
|
||||
if (currentEvent != null)
|
||||
{
|
||||
_name = currentEvent.Name;
|
||||
_description = currentEvent.Description;
|
||||
_eventDate = currentEvent.EventDate;
|
||||
_location = currentEvent.Location;
|
||||
_createdby = currentEvent.CreatedBy;
|
||||
_createdon = currentEvent.CreatedOn;
|
||||
_modifiedby = currentEvent.ModifiedBy;
|
||||
@ -121,41 +134,4 @@
|
||||
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
validated = true;
|
||||
var interop = new Oqtane.UI.Interop(JSRuntime);
|
||||
if (await interop.FormValid(form))
|
||||
{
|
||||
if (PageState.Action == "Add")
|
||||
{
|
||||
Event EventRegistration = new Event();
|
||||
EventRegistration.ModuleId = ModuleState.ModuleId;
|
||||
EventRegistration.Name = _name;
|
||||
EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration);
|
||||
await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration);
|
||||
}
|
||||
else
|
||||
{
|
||||
Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId);
|
||||
EventRegistration.Name = _name;
|
||||
await EventRegistrationService.UpdateEventAsync(EventRegistration);
|
||||
await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration);
|
||||
}
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage(Localizer["Message.SaveValidation"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving EventRegistration {Error}", ex.Message);
|
||||
AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user