标签:
/// <summary> /// 汽车商标 获取 /// Redis Key=zgqp315_Redis_TrademarkC_List /// </summary> /// <returns></returns> public static RedisJsonResult Get_TrademarkC() { //var redisClient = RedisManager.GetClient(); var redisClient = new RedisClient("127.0.0.1", 6379);//redis服务IP和端口 int jsCode = 1; string jsMessage = "一切正常"; List<TrademarkC> IList_TrademarkC = null; try { IList_TrademarkC = redisClient.Get<List<TrademarkC>>("zgqp315_Redis_TrademarkC_List"); //根据 字段 FirstLetter 进行去重复 开始 var list_TrademarkC = IList_TrademarkC.GroupBy(m => m.FirstLetter.ToLower().Trim()).Select(m => new { TrademarkId = m.FirstOrDefault().TrademarkId }); IList_TrademarkC = IList_TrademarkC.Where(m => list_TrademarkC.Select(mo => mo.TrademarkId).Contains(m.TrademarkId)).ToList(); //根据 字段 FirstLetter 进行去重复 结束 } catch (Exception ex) { jsCode = 0; jsMessage = ex.Message; } return new RedisJsonResult() { JsCode = jsCode, JsMessage = jsMessage, data_TrademarkC = IList_TrademarkC, success = true, }; }
标签:
原文地址:http://www.cnblogs.com/foreverfendou/p/5609889.html