Example #1
0
        public IHttpActionResult PostTradeInfo([FromBody] TradeQueryModel query)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            ICollection <TradeModel> output = _service.Get(query);

            return(Ok(output));
        }
Example #2
0
 public ICollection <TradeModel> Get(TradeQueryModel q)
 {
     //check that each field was set from the user. If is null/empty/default value, then output true so it will not taken into account for the equality
     return(db.Trades.Where(e => (
                                (q.LowerBoundDate == default(DateTime) ? true : q.LowerBoundDate < e.DateTime) &&
                                (q.UpperBoundDate == default(DateTime) ? true : q.UpperBoundDate > e.DateTime) &&
                                (String.IsNullOrEmpty(q.ShareSymbol) ? true : q.ShareSymbol == e.ShareId) &&
                                (String.IsNullOrEmpty(q.SellerId) ? true : q.SellerId == e.SellerId) &&
                                (String.IsNullOrEmpty(q.BuyerId) ? true : q.BuyerId == e.BuyerId))).ToList());
     //return new List<TradeModel>();
 }
 //general query.todo: modify return type to tradeoutviewmodel
 public ICollection <TradeModel> Get(TradeQueryModel query)
 {
     return(_repository.Get(query));
 }