public void Test_UpdateSpanDays() { TradePositionBLL bll = new TradePositionBLL(_unit); TransactionBLL tbll = new TransactionBLL(_unit); List <TradePosition> aList = bll.GetListByAccount(1060); foreach (var p in aList) { if (p.ExitTransactionId.HasValue) { var entryTrans = tbll.GetByID(p.EntryTransactionId); var exitTrans = tbll.GetByID(p.ExitTransactionId.Value); p.days = new TickerBLL(_unit).GetTradesDaySpan(p.ShareId, entryTrans.TradingDate, exitTrans.TradingDate); bll.Update(p); } } }
public async Task <IHttpActionResult> GetTransactionById(int id) { Transaction tr = null; try { TransactionBLL bll = new TransactionBLL(_unit); tr = bll.GetByID(id); } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(tr)); }