Files

30 lines
991 B
C#

using _0_Framework.InfraStructure;
using AccountManagement.Application.Contracts.SubAccount;
using AccountManagement.Domain.SubAccountRoleAgg;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
namespace AccountMangement.Infrastructure.EFCore.Repository
{
public class SubAccountRoleRepository : RepositoryBase<long, SubAccountRole>, ISubAccountRoleRepository
{
private readonly AccountContext _accountContext;
public SubAccountRoleRepository(AccountContext context) : base(context)
{
_accountContext = context;
}
public List<SubAccountRoleViewModel> GetSubAccountRolesByAccountId(long accountId)
{
return _accountContext.SubAccountRoles.Where(x => x.AccountId == accountId)
.Select(x => new SubAccountRoleViewModel()
{
Id = x.id,
Title = x.Title
}).ToList();
}
}
}