Exemple #1
0
        public HttpResponseMessage Get([FromBody] JObject requestParam)
        {
            Trade trade = null;

            try
            {
                trade = JsonConvert.DeserializeObject <Trade>(requestParam["Trade"].ToString());
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "参数错误" + ex.Message));
            }

            try
            {
                var result = tradeDao.Get(trade);
                if (result != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { result }));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, "获取失败"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }