Exemple #1
0
 public HttpResponseMessage GetOrder([FromBody] CC_Order order)
 {
     try
     {
         var db     = new RedisOperation(_RedisDB);
         var key    = RedisKeys.CCAllOrder(order.CustomerID);
         var result = db.SelectListQueue <CC_Order>(key);
         if (result.CustomerID.IsNullStr())
         {
             return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
             {
                 Code = ResponseCode.DataNotFound,
                 Message = "success"
             }));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel <CC_Order>
         {
             Code = ResponseCode.Success,
             Message = "success",
             Result = result
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }
Exemple #2
0
 public HttpResponseMessage SetOrder([FromBody] CC_Order order)
 {
     try
     {
         var db  = new RedisOperation(_RedisDB);
         var key = RedisKeys.CCAllOrder(order.CustomerID);
         db.InsertListQueue(key, order);
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Success,
             Message = "success"
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }
Exemple #3
0
 public HttpResponseMessage GetOrderLength([FromBody] CC_Order order)
 {
     try
     {
         var db     = new RedisOperation(_RedisDB);
         var key    = RedisKeys.CCAllOrder(order.CustomerID);
         var result = db.GetListLength(key);
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel <long>
         {
             Code = ResponseCode.Success,
             Message = "success",
             Result = result
         }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new ResponseModel
         {
             Code = ResponseCode.Fail,
             Message = "fail:" + ex.Message
         }));
     }
 }