using LCU.Api.Internal.MaidBotLib.Models; using LCU.Api.Internal.MaidBotLib.Persistence; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace LCU.Api.Internal.MaidBotLib.Repositories { public class LoggingMatrixRepository : BaseRepository, ILoggingMatrixRepository { public LoggingMatrixRepository(AppDbContext context) : base(context) { } public async Task> ListAsync() { return await _context.LoggingMatrixs.ToListAsync(); } public async Task> ListActiveAsync() { return await _context.LoggingMatrixs.Where(loggingMatrix => !loggingMatrix.Disabled).ToListAsync(); } public async Task FindByIdAsync(int id) { return await _context.LoggingMatrixs.Where(loggingMatrix => loggingMatrix.LoggingMatrixId == id).FirstOrDefaultAsync(); } public async Task> RetrieveByApplicationLevelAndGroup(string application, string level, string group) { return await _context.LoggingMatrixs .Where(matrix => matrix.Application == application && matrix.Level == level && matrix.Group == group && !matrix.Disabled) .ToListAsync(); } public async Task> RetrieveByApplciationAndLevel(string application, string level) { return await _context.LoggingMatrixs .Where(matrix => matrix.Application == application && matrix.Level == level && !matrix.Disabled) .ToListAsync(); } public async Task AddAsync(LoggingMatrix loggingMatrix) { var result = await _context.LoggingMatrixs.AddAsync(loggingMatrix); return result.Entity; } public void Update(LoggingMatrix loggingMatrix) { _context.LoggingMatrixs.Update(loggingMatrix); } } }