Ejemplo n.º 1
0
        /// <summary>
        /// 承运商信息模糊查询
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public JsonResult GetCarrierByName(string name = "", bool contactBlackCarrier = true)
        {
            List <CarrierEntity> outList = new List <CarrierEntity>();
            List <CarrierEntity> list    = CarrierService.GetCarrierAll(contactBlackCarrier);

            if (list != null && list.Count > 0)
            {
                if (!string.IsNullOrEmpty(name))
                {
                    var v = from d in list where d.CarrierName.Contains(name) select d;

                    if (v != null)
                    {
                        foreach (var k in v)
                        {
                            CarrierEntity model = new CarrierEntity();
                            model.CarrierID   = k.CarrierID;
                            model.CarrierName = k.CarrierName;
                            outList.Add(model);
                        }
                    }
                }
                else
                {
                    foreach (CarrierEntity entity in list)
                    {
                        outList.Add(entity);
                    }
                }
            }

            return(Json(outList));
        }