public IEnumerable <ProductVM> GetList(string query, int typeId, int cateId, int limited, int offset, ProductSort?sort) { var result = _productSer.GetList(query, typeId, cateId, limited, offset, sort); RespHelper.AddTotalPage(HttpContext, result.Total); return(result.Products); }
public IEnumerable <UserVM> GetList(int limited, int offset, string query = null) { var result = _userSer.GetList(query, limited, offset); RespHelper.AddTotalPage(HttpContext, result.TotalItem); return(result.Users); }
public ActionResult <IEnumerable <OrderVM> > GetListByUser(string userId, int provinceId, int limited, int offset) { if (string.IsNullOrEmpty(userId) || string.IsNullOrWhiteSpace(userId)) { return(BadRequest()); } var result = _orderSer.GetListByUser(userId, provinceId, limited, offset); RespHelper.AddTotalPage(HttpContext, result.TotalItem); return(Ok(result.Orders)); }
public ActionResult <ICollection <OrderVM> > GetList(string start, string end, int provinceId, int limited, int offset) { if (start == null || end == null) { return(BadRequest()); } var result = _orderSer.GetList(start, end, provinceId, limited, offset); RespHelper.AddTotalPage(HttpContext, result.TotalItem); return(Ok(result.Orders)); }
public void Get(string key, Stream destination, int bufferSize = 1024) { var cmd = "GET".Input(key).FlagKey(key); LogCall(cmd, () => { using (var rds = _adapter.GetRedisSocket(cmd)) { rds.Write(cmd); RespHelper.ReadChunk(rds.Stream, destination, bufferSize); } return default(string); }); }
static void EndPipe(IRedisSocket rds, IEnumerable <PipelineCommand> cmds) { var err = new List <PipelineCommand>(); var ms = new MemoryStream(); try { foreach (var cmd in cmds) { RespHelper.Write(ms, rds.Encoding, cmd.Command, rds.Protocol); } if (rds.IsConnected == false) { rds.Connect(); } ms.Position = 0; ms.CopyTo(rds.Stream); foreach (var pc in cmds) { pc.Command._redisSocket = rds; pc.Result = pc.Parse(pc); if (pc.Command.ReadResult.IsError) { err.Add(pc); } } } finally { ms.Close(); ms.Dispose(); rds?.Dispose(); } if (err.Any()) { var sb = new StringBuilder(); for (var a = 0; a < err.Count; a++) { var cmd = err[a].Command; if (a > 0) { sb.Append("\r\n"); } sb.Append(cmd.ReadResult.SimpleError).Append(" {").Append(cmd.ToString()).Append("}"); } throw new RedisException(sb.ToString()); } }
private JArray getRes(JToken res = null) => RespHelper.getRes(res);
private JArray getErrorRes(string code) => RespHelper.getErrorRes(code);
private bool checkResCode(JArray res) => RespHelper.checkResCode(res);