public IList <AccountReceiveableView> GetAccountReceivablesByCustomerId(long customerId) { try { //IEnumerable<AcctRec> acctRecList = null; var query = (from e in _dbContext.AcctRecs where e.CustomerId == customerId && e.OpenAmount > 0 select e); //Task.WaitAny(acctRecTask); //acctRecList = acctRecTask.; IList <AccountReceiveableView> list = new List <AccountReceiveableView>(); foreach (var item in query) { list.Add(applicationViewFactory.MapAccountReceivableView(item)); } return(list); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
public async Task <AccountReceiveableView> GetAccountReceivableViewByInvoiceId(long?invoiceId) { try { var query = await(from a in _dbContext.AcctRecs where a.InvoiceId == invoiceId select a).FirstOrDefaultAsync <AcctRec>(); if (query != null) { AccountReceiveableView view = applicationViewFactory.MapAccountReceivableView(query); return(view); } return(null); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }