29 lines
810 B
C#
29 lines
810 B
C#
using System.Linq;
|
|
using Company.Domain.AuthorizedPersonAgg;
|
|
using _0_Framework.InfraStructure;
|
|
using CompanyManagment.EFCore;
|
|
|
|
namespace CompanyManagment.EFCore.Repository;
|
|
|
|
public class AuthorizedPersonRepository : RepositoryBase<long, AuthorizedPerson>, IAuthorizedPersonRepository
|
|
{
|
|
private readonly CompanyContext _context;
|
|
|
|
public AuthorizedPersonRepository(CompanyContext context) : base(context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public AuthorizedPerson GetByNationalCode(string nationalCode)
|
|
{
|
|
return _context.AuthorizedPersons
|
|
.FirstOrDefault(x => x.NationalCode == nationalCode);
|
|
}
|
|
|
|
public bool ExistsByNationalCode(string nationalCode)
|
|
{
|
|
return _context.AuthorizedPersons
|
|
.Any(x => x.NationalCode == nationalCode);
|
|
}
|
|
}
|