COSMETIC: rename EventRepository

This commit is contained in:
Konstantin Hintermayer
2025-05-12 11:47:25 +02:00
parent 467d11c97b
commit 7977f92a06
5 changed files with 31 additions and 31 deletions

View File

@ -15,10 +15,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
{ {
public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable
{ {
private readonly IEventRegistrationRepository _EventRegistrationRepository; private readonly IEventRepository _EventRegistrationRepository;
private readonly IDBContextDependencies _DBContextDependencies; private readonly IDBContextDependencies _DBContextDependencies;
public EventRegistrationManager(IEventRegistrationRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies) public EventRegistrationManager(IEventRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies)
{ {
_EventRegistrationRepository = EventRegistrationRepository; _EventRegistrationRepository = EventRegistrationRepository;
_DBContextDependencies = DBContextDependencies; _DBContextDependencies = DBContextDependencies;
@ -37,7 +37,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
public string ExportModule(Oqtane.Models.Module module) public string ExportModule(Oqtane.Models.Module module)
{ {
string content = ""; string content = "";
List<Models.Event> EventRegistrations = _EventRegistrationRepository.GetEventRegistrations(module.ModuleId).ToList(); List<Models.Event> EventRegistrations = _EventRegistrationRepository.GetEvents(module.ModuleId).ToList();
if (EventRegistrations != null) if (EventRegistrations != null)
{ {
content = JsonSerializer.Serialize(EventRegistrations); content = JsonSerializer.Serialize(EventRegistrations);
@ -56,7 +56,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
{ {
foreach(var EventRegistration in EventRegistrations) foreach(var EventRegistration in EventRegistrations)
{ {
_EventRegistrationRepository.AddEventRegistration(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name }); _EventRegistrationRepository.AddEvent(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name });
} }
} }
} }
@ -65,7 +65,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
{ {
var searchContentList = new List<SearchContent>(); var searchContentList = new List<SearchContent>();
foreach (var EventRegistration in _EventRegistrationRepository.GetEventRegistrations(pageModule.ModuleId)) foreach (var EventRegistration in _EventRegistrationRepository.GetEvents(pageModule.ModuleId))
{ {
if (EventRegistration.ModifiedOn >= lastIndexedOn) if (EventRegistration.ModifiedOn >= lastIndexedOn)
{ {

View File

@ -5,27 +5,27 @@ using Oqtane.Modules;
namespace SZUAbsolventenverein.Module.EventRegistration.Repository namespace SZUAbsolventenverein.Module.EventRegistration.Repository
{ {
public class EventRegistrationRepository : IEventRegistrationRepository, ITransientService public class EventRepository : IEventRepository, ITransientService
{ {
private readonly IDbContextFactory<EventRegistrationContext> _factory; private readonly IDbContextFactory<EventRegistrationContext> _factory;
public EventRegistrationRepository(IDbContextFactory<EventRegistrationContext> factory) public EventRepository(IDbContextFactory<EventRegistrationContext> factory)
{ {
_factory = factory; _factory = factory;
} }
public IEnumerable<Models.Event> GetEventRegistrations(int ModuleId) public IEnumerable<Models.Event> GetEvents(int ModuleId)
{ {
using var db = _factory.CreateDbContext(); using var db = _factory.CreateDbContext();
return db.Event.Where(item => item.ModuleId == ModuleId).ToList(); return db.Event.Where(item => item.ModuleId == ModuleId).ToList();
} }
public Models.Event GetEventRegistration(int EventRegistrationId) public Models.Event GetEvent(int EventRegistrationId)
{ {
return GetEventRegistration(EventRegistrationId, true); return GetEvent(EventRegistrationId, true);
} }
public Models.Event GetEventRegistration(int EventRegistrationId, bool tracking) public Models.Event GetEvent(int EventRegistrationId, bool tracking)
{ {
using var db = _factory.CreateDbContext(); using var db = _factory.CreateDbContext();
if (tracking) if (tracking)
@ -38,7 +38,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
} }
} }
public Models.Event AddEventRegistration(Models.Event EventRegistration) public Models.Event AddEvent(Models.Event EventRegistration)
{ {
using var db = _factory.CreateDbContext(); using var db = _factory.CreateDbContext();
db.Event.Add(EventRegistration); db.Event.Add(EventRegistration);
@ -46,7 +46,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
return EventRegistration; return EventRegistration;
} }
public Models.Event UpdateEventRegistration(Models.Event EventRegistration) public Models.Event UpdateEvent(Models.Event EventRegistration)
{ {
using var db = _factory.CreateDbContext(); using var db = _factory.CreateDbContext();
db.Entry(EventRegistration).State = EntityState.Modified; db.Entry(EventRegistration).State = EntityState.Modified;
@ -54,7 +54,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
return EventRegistration; return EventRegistration;
} }
public void DeleteEventRegistration(int EventRegistrationId) public void DeleteEvent(int EventRegistrationId)
{ {
using var db = _factory.CreateDbContext(); using var db = _factory.CreateDbContext();
Models.Event EventRegistration = db.Event.Find(EventRegistrationId); Models.Event EventRegistration = db.Event.Find(EventRegistrationId);

View File

@ -1,15 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
{
public interface IEventRegistrationRepository
{
IEnumerable<Models.Event> GetEventRegistrations(int ModuleId);
Models.Event GetEventRegistration(int EventRegistrationId);
Models.Event GetEventRegistration(int EventRegistrationId, bool tracking);
Models.Event AddEventRegistration(Models.Event EventRegistration);
Models.Event UpdateEventRegistration(Models.Event EventRegistration);
void DeleteEventRegistration(int EventRegistrationId);
}
}

View File

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
{
public interface IEventRepository
{
IEnumerable<Models.Event> GetEvents(int ModuleId);
Models.Event GetEvent(int EventRegistrationId);
Models.Event GetEvent(int EventRegistrationId, bool tracking);
Models.Event AddEvent(Models.Event EventRegistration);
Models.Event UpdateEvent(Models.Event EventRegistration);
void DeleteEvent(int EventRegistrationId);
}
}

View File

@ -14,13 +14,13 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
{ {
public class ServerEventRegistrationService : IEventRegistrationService public class ServerEventRegistrationService : IEventRegistrationService
{ {
private readonly IEventRegistrationRepository _EventRegistrationRepository; private readonly IEventRepository _EventRegistrationRepository;
private readonly IUserPermissions _userPermissions; private readonly IUserPermissions _userPermissions;
private readonly ILogManager _logger; private readonly ILogManager _logger;
private readonly IHttpContextAccessor _accessor; private readonly IHttpContextAccessor _accessor;
private readonly Alias _alias; private readonly Alias _alias;
public ServerEventRegistrationService(IEventRegistrationRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) public ServerEventRegistrationService(IEventRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor)
{ {
_EventRegistrationRepository = EventRegistrationRepository; _EventRegistrationRepository = EventRegistrationRepository;
_userPermissions = userPermissions; _userPermissions = userPermissions;