public List <BankAccount> GetBankAccounts(Domain.ViewModels.QueryOptions queryOptions, SearchObject searchObject,
                                                  out int totalCount)
        {
            var  result = new List <BankAccount>();
            Guid supplierDepartmentId;

            if (!Guid.TryParse(searchObject.SupplierDepartmentId, out supplierDepartmentId))
            {
                result = _repository.Query(GetSearchCriteria(searchObject))
                         .OrderBy(GetOrder(queryOptions.SortField, queryOptions.SortOrder))
                         .SelectPage(queryOptions.CurrentPage, queryOptions.PageSize, out totalCount)
                         .ToList <BankAccount>();
            }
            else
            {
                // search by SupplierDepartmentId
                result = _repository.Query(GetSearchCriteria(searchObject))
                         .Include(x => x.SupplierBankAccounts)
                         .OrderBy(GetOrder(queryOptions.SortField, queryOptions.SortOrder))
                         .SelectPage(queryOptions.CurrentPage, queryOptions.PageSize, out totalCount)
                         .ToList <BankAccount>();
            }

            return(result);
        }
 public List <PurchaseInvoice> GetPurchaseInvoices(Domain.ViewModels.QueryOptions queryOptions, SearchObject searchObject,
                                                   out int totalCount)
 {
     return(_repository.Query(GetSearchCriteria(searchObject))
            .Include(inc => inc.PurchaseInvoiceItems)
            .Include(inc => inc.SupplierDepartment.Supplier)
            .OrderBy(GetOrder(queryOptions.SortField, queryOptions.SortOrder))
            .SelectPage(queryOptions.CurrentPage, queryOptions.PageSize, out totalCount)
            .ToList <PurchaseInvoice>());
 }