43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using LCU.API.Internal.RepoApi.Repos.Models;
|
|
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
|
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
|
{
|
|
public class AuctionHouseRepository : BaseRepository, IAuctionHouseRepository
|
|
{
|
|
|
|
public AuctionHouseRepository(AppDbContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public async Task<IEnumerable<AuctionHouse>> ListAllAsync()
|
|
{
|
|
return await _context.Auctions.ToListAsync();
|
|
}
|
|
|
|
public async Task AddAsync(AuctionHouse auction)
|
|
{
|
|
await _context.Auctions.AddAsync(auction);
|
|
}
|
|
|
|
public async Task<AuctionHouse> FindByIdAsync(string id)
|
|
{
|
|
return await Queryable.Where<AuctionHouse>(_context.Auctions, c => c.AuctionID == id).FirstOrDefaultAsync();
|
|
}
|
|
|
|
public void Update(AuctionHouse auction)
|
|
{
|
|
_context.Auctions.Update(auction);
|
|
}
|
|
|
|
public void Remove(AuctionHouse auction)
|
|
{
|
|
_context.Auctions.Remove(auction);
|
|
}
|
|
}
|
|
} |