Files
2026-04-20 14:47:24 -05:00

42 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LCU.Shared.Collections.RepoApiLib.Models.Settings;
using LCU.Shared.Collections.RepoApiLib.Persistence;
using Microsoft.EntityFrameworkCore;
namespace LCU.Shared.Collections.RepoApiLib.Repositories.Settings
{
public class CleaningLevelRepository : BaseRepository, ICleaningLevelRepository
{
public CleaningLevelRepository(AppDbContext context) : base(context)
{
}
public async Task<IEnumerable<CleaningLevel>> ListAllAsync()
{
return await _context.CleaningLevelCodes.ToListAsync();
}
public async Task AddAsync(CleaningLevel cleaningLevelCodes)
{
await _context.CleaningLevelCodes.AddAsync(cleaningLevelCodes);
}
public async Task<CleaningLevel> FindByIdAsync(int id)
{
return await _context.CleaningLevelCodes.Where(c => c.Code == id).FirstOrDefaultAsync();
}
public void Update(CleaningLevel category)
{
_context.CleaningLevelCodes.Update(category);
}
public void Remove(CleaningLevel category)
{
_context.CleaningLevelCodes.Remove(category);
}
}
}