public Balance GetBalance(AccountingParams accountingParams) { return(new Balance() { BillsFromPartner = Bills .ApplySearch(accountingParams) .Where(x => !x.IssuedByCondominium) .Sum(x => x.Items.Sum(x => x.Price)), BillsToPartner = Bills .ApplySearch(accountingParams) .Where(x => x.IssuedByCondominium) .Sum(x => x.Items.Sum(x => x.Price)), TransactionFromPartner = Transactions .ApplySearch(accountingParams) .Where(x => x.IsReceived) .Sum(x => x.Amount), TransactionToPartner = Transactions .ApplySearch(accountingParams) .Where(x => !x.IsReceived) .Sum(x => x.Amount) }); }
public List <Bill> GetBills(BillSearchParams search) { return(Bills.ApplySearch(search) .Select(x => x.ToModel()) .ToList()); }