示例#1
0
        public ActionResult AddRegionRestriction(int settingId, int?provinceId, int?instructionId)
        {
            ViewData["RestrictionType"] = EnumHelper.GetSelectListFromEnumType(typeof(RestrictionType));
            ViewData["Province"]        = new SelectList(ChinaRegionInfo.AllProvinces, "Id", "Name", provinceId.GetValueOrDefault());
            var cities = new List <City> {
                new City {
                    Id = 0, Name = "请选择", ProvinceId = 0
                }
            };

            if (provinceId.HasValue)
            {
                var relatedCities = this.SMSService.GetCityByProvinceId(provinceId.GetValueOrDefault());
                if (relatedCities != null)
                {
                    foreach (var c in relatedCities)
                    {
                        cities.Add(new City {
                            Id = c.Id, Name = c.Name, ProvinceId = c.ProvinceId
                        });
                    }
                }
            }

            ViewData["City"] = new SelectList(cities, "Id", "Name");


            SettingInRegion model = new SettingInRegion();

            model.SettingId = settingId;

            //if (instructionId.HasValue)
            //{
            ViewData["InstructionId"] = instructionId.GetValueOrDefault();

            TempData["InstructionId"] = TempData["InstructionId"];
            TempData["SPId"]          = TempData["SPId"];
            TempData["ServiceId"]     = TempData["ServiceId"];
            return(View(model));
        }
示例#2
0
 public ActionResult AddRegionRestriction(SettingInRegion model)
 {
     this.SMSUIService.Add <SettingInRegion>(model);
     return(RedirectToAction("RegionRestriction", new { settingId = model.SettingId, spId = TempData["SPId"], serviceId = TempData["ServiceId"], InstructionId = TempData["InstructionId"] }));
 }