จัดระเบียบ Code ใหม่ และเพิ่ม Extension Method
implement GenericRepository Class ใหม่
This commit is contained in:
parent
e49c6a4aca
commit
89de09d213
21 changed files with 1439 additions and 63 deletions
|
|
@ -1,26 +1,28 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Entities.MetaData.Prefix;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Prefix
|
||||
{
|
||||
public class PrefixRepository : IGenericRepository<Guid, PrefixEntity>
|
||||
public class PrefixRepository : GenericRepository<Guid, PrefixEntity>
|
||||
{
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
#region " Fields "
|
||||
|
||||
public PrefixRepository(IApplicationDBContext dbContext)
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PrefixRepository(IApplicationDBContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<PrefixEntity>> GetAllAsync()
|
||||
{
|
||||
return await _dbContext.MD_Prefixes.ToListAsync();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public async Task<PrefixEntity?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _dbContext.MD_Prefixes.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue