public Entities.Dashboard GetUserDashboard(Guid userId)
        {
            var transactions = _context.Set <Entities.Transaction>();

            var customers = _context.Set <Entities.Customer>();

            int transactionCount = transactions.Count(t => t.Customer.UserId == userId);

            var customerList = customers.Where(c => c.UserId == userId)
                               .Select(c => new Entities.Customer
            {
                Id = c.Id,
                ReceivableBalance = c.ReceivableBalance,
                DebtBalance       = c.DebtBalance,
            })
                               .ToList();

            return(new Entities.Dashboard
            {
                Customers = customerList,
                TransactionCount = transactionCount
            });
        }
 /// <summary>
 /// sets and returns new entities which is different from main entity
 /// </summary>
 /// <typeparam name="TNewEntity"></typeparam>
 /// <returns></returns>
 protected DbSet <TNewEntity> GetEntities <TNewEntity>() where TNewEntity : EntityBase
 {
     return(_context.Set <TNewEntity>());
 }
 public PostgreSqlDbRepository(BlackCoveredLedgerDbContext context)
 {
     _context = context;
     Entities = _context.Set <TEntity>();
 }