Files
monorepo/LCU.API.Collections.RepoApi-old/LCU.Shared.Collections.RepoApiLib/Repositories/RepoStatusChangeRepository.cs
T
2026-04-20 14:47:24 -05:00

38 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LCU.Shared.Collections.RepoApiLib.Models;
using LCU.Shared.Collections.RepoApiLib.Persistence;
using Microsoft.EntityFrameworkCore;
namespace LCU.Shared.Collections.RepoApiLib.Repositories
{
public class RepoStatusChangeRepository : BaseRepository, IRepoStatusChangeRepository
{
public RepoStatusChangeRepository(AppDbContext context) : base(context)
{
}
public async Task<IEnumerable<RepoStatusChange>> ListAsync()
{
return await _context.RepoStatusChanges.ToListAsync();
}
public async Task<IEnumerable<RepoStatusChange>> ListForAccountAsync(int repoAccountId)
{
return await Queryable.Where<RepoStatusChange>(_context.RepoStatusChanges, p => p.RepoId == repoAccountId).ToListAsync();
}
public async Task<RepoStatusChange> AddAsync(RepoStatusChange statusChange)
{
var result = await _context.RepoStatusChanges.AddAsync(statusChange);
return result.Entity;
}
public async Task<RepoStatusChange> FindByIdAsync(int id)
{
return await _context.RepoStatusChanges.FindAsync(id);
}
}
}