Implemented EventRegistrationService Event Methods
This commit is contained in:
@ -31,7 +31,17 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
|
||||
public Task<Event> AddEventAsync(Event NewEvent)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
NewEvent = _EventRegistrationRepository.AddEventRegistration(NewEvent);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", NewEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {NewEvent}", NewEvent);
|
||||
NewEvent = null;
|
||||
}
|
||||
return Task.FromResult(NewEvent);
|
||||
}
|
||||
|
||||
public Task<Response> AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType)
|
||||
@ -41,7 +51,16 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
|
||||
public Task DeleteEventAsync(int EventId, int ModuleId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
_EventRegistrationRepository.DeleteEventRegistration(EventId);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventId}", EventId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventId} {ModuleId}", EventId, ModuleId);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId)
|
||||
@ -55,16 +74,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
}
|
||||
|
||||
public Task<List<Event>> GetEventsAsync(int ModuleId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<Event> UpdateEventAsync(Event NewEvent)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/*public Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
||||
{
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
||||
{
|
||||
@ -77,6 +86,23 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
}
|
||||
}
|
||||
|
||||
public Task<Event> UpdateEventAsync(Event NewEvent)
|
||||
{
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
NewEvent = _EventRegistrationRepository.UpdateEventRegistration(NewEvent);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "EventRegistration Updated {NewEvent}", NewEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Update Attempt {NewEvent}", NewEvent);
|
||||
NewEvent = null;
|
||||
}
|
||||
return Task.FromResult(NewEvent);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||
{
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
||||
@ -120,18 +146,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
return Task.FromResult(EventRegistration);
|
||||
}
|
||||
|
||||
public Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||
{
|
||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
_EventRegistrationRepository.DeleteEventRegistration(EventRegistrationId);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventRegistrationId}", EventRegistrationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventRegistrationId} {ModuleId}", EventRegistrationId, ModuleId);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user