public async Task <ActionResult <List <Quote> > > GetRange(string symbol, DateTime startdate, DateTime stopdate) { List <Quote> quoteList = new List <Quote>(); Equity equity = await eMgr.GetBySymbol(symbol); if (equity == default(Equity)) { return(BadRequest(quoteList)); } else { quoteList = await qMgr.GetByEquityIdAndDateRange(equity.Id, startdate, stopdate); if (!quoteList.Any()) { return(BadRequest(quoteList)); } } return(Ok(quoteList)); }
public async Task <ActionResult <Equity> > GetBySymbol(string symbol) { Equity mgrResult = await eqMgr.GetBySymbol(symbol); if (mgrResult == default(Equity)) { return(BadRequest(mgrResult)); } else { return(Ok(mgrResult)); } }
public async Task <ActionResult <List <Quote> > > GetRange(string symbol, DateTime startdate, DateTime stopdate) { ManagerResult <List <Quote> > mrQuoteList = new ManagerResult <List <Quote> >(); Equity equity = await eMgr.GetBySymbol(symbol); if (equity == default) { mrQuoteList.Success = false; mrQuoteList.Message = $"Error fetching symbol: {symbol}"; mrQuoteList.Entity = new List <Quote>(); return(BadRequest(mrQuoteList)); } else { mrQuoteList = await qMgr.GetByEquityIdAndDateRange(equity.Id, startdate, stopdate); if (!mrQuoteList.Success) { return(BadRequest(mrQuoteList)); } } return(Ok(mrQuoteList.Entity)); }
public async Task <ActionResult <Equity> > GetBySymbol(string symbol) { ManagerResult <Equity> mgrResult = new ManagerResult <Equity> { Entity = await eqMgr.GetBySymbol(symbol) }; if (mgrResult.Entity == default) { mgrResult.Success = false; mgrResult.Message = $"Error getting equity by symbol: {symbol}"; return(BadRequest(mgrResult)); } else { return(Ok(mgrResult.Entity)); } }