LANCommander/LANCommander.Server.Services/EngineService.cs

36 lines
1.2 KiB
C#
Raw Permalink Normal View History

using AutoMapper;
using LANCommander.Server.Data;
2024-08-04 18:44:33 -05:00
using LANCommander.Server.Data.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using ZiggyCreatures.Caching.Fusion;
2024-03-29 17:19:42 -05:00
2024-08-04 18:44:33 -05:00
namespace LANCommander.Server.Services
2024-03-29 17:19:42 -05:00
{
public sealed class EngineService(
ILogger<EngineService> logger,
SettingsProvider<Settings.Settings> settingsProvider,
IFusionCache cache,
IMapper mapper,
IHttpContextAccessor httpContextAccessor,
IDbContextFactory<DatabaseContext> contextFactory) : BaseDatabaseService<Engine>(logger, settingsProvider, cache, mapper, httpContextAccessor, contextFactory)
2024-03-29 17:19:42 -05:00
{
2025-02-23 08:49:43 -06:00
public override async Task<Engine> AddAsync(Engine entity)
{
return await base.AddAsync(entity, async context =>
{
await context.UpdateRelationshipAsync(e => e.Games);
});
}
2025-02-02 14:58:07 -06:00
public override async Task<Engine> UpdateAsync(Engine entity)
{
2025-02-02 14:58:07 -06:00
return await base.UpdateAsync(entity, async context =>
{
await context.UpdateRelationshipAsync(e => e.Games);
});
}
2024-03-29 17:19:42 -05:00
}
}