public ActionResult CountryPaintItem(string pkid = null)
        {
            List <SelectListItem>    lsSelItem = new List <SelectListItem>();
            IEnumerable <PaintModel> list      = CityPaintManager.SelectPaintList();

            if (list != null && list.Any())
            {
                foreach (var paint in list)
                {
                    SelectListItem sel = new SelectListItem();
                    sel       = new SelectListItem();
                    sel.Value = paint.PID.ToString();
                    sel.Text  = paint.DisplayName;
                    lsSelItem.Add(sel);
                }
            }
            List <SelectListItem> listItem = new List <SelectListItem>();

            PaintInfoModel model = new PaintInfoModel();

            if (pkid != null)
            {
                model = CityPaintManager.GetCountryPaintByPKID(Int32.Parse(pkid));
                if (model.PID != null)
                {
                    foreach (var ss in lsSelItem)
                    {
                        if (ss.Value == model.PID.ToString())
                        {
                            ss.Selected = true;
                        }
                        listItem.Add(ss);
                    }
                }
                else
                {
                    listItem = lsSelItem;
                }
            }
            else
            {
                listItem = lsSelItem;
            }
            SelectList ddlSelData = new SelectList(listItem.AsEnumerable(), "Value", "Text", "请选择");

            ViewData["ddlPaintTypeData"] = ddlSelData;

            return(View("CountryPaintItem", model));
        }
        public ActionResult CityPaintItem(string pkid = null)
        {
            List <SelectListItem>    lsSelItem = new List <SelectListItem>();
            IEnumerable <PaintModel> list      = CityPaintManager.SelectPaintList();

            if (list != null && list.Any())
            {
                foreach (var paint in list)
                {
                    SelectListItem sel = new SelectListItem();
                    sel       = new SelectListItem();
                    sel.Value = paint.PID.ToString();
                    sel.Text  = paint.DisplayName;
                    lsSelItem.Add(sel);
                }
            }
            List <SelectListItem> listItem = new List <SelectListItem>();

            PaintInfoModel model = new PaintInfoModel();

            if (pkid != null)
            {
                model = CityPaintManager.GetCityPaintByPKID(Int32.Parse(pkid));
                if (model.PID != null)
                {
                    foreach (var ss in lsSelItem)
                    {
                        if (ss.Value == model.PID.ToString())
                        {
                            ss.Selected = true;
                        }
                        listItem.Add(ss);
                    }
                }
                else
                {
                    listItem = lsSelItem;
                }
            }
            else
            {
                listItem = lsSelItem;
            }
            SelectList ddlSelData = new SelectList(listItem.AsEnumerable(), "Value", "Text", "请选择");

            ViewData["ddlPaintTypeData"] = ddlSelData;
            #region 获取所有城市
            var cityList = CityPaintManager.SelectAllCityRegionList().ToList();

            if (pkid != null)
            {
                var selectedCityList = CityPaintManager.SelectPaintCityList(Convert.ToInt32(pkid)).ToList();
                foreach (var city in cityList)
                {
                    var cl = selectedCityList.Where(x => x.CityId == city.CityID);
                    if (cl.Any())
                    {
                        city.Selected = true;
                    }
                }
            }

            model.CityList = cityList;

            #endregion
            return(View("CityPaintItem", model));
        }