/// <summary> /// 编辑 /// </summary> /// <param name="vm"></param> /// <returns></returns> public ActionResult Edit(BusinessInfoVM vm) { //获取当前用户角色 vm.RoleId = Loginer.RoleId; if (vm.RoleId == (int)RoleTypeEnum.商家) { vm.Id = int.Parse(Loginer.BusinessId); } var _areas = _baseAreaService.GetAll(); vm.BusinessInfo = _businessInfoService.GetById(vm.Id) ?? new BusinessInfo(); vm.Provinces = _areas.Where(p => p.Grade == 1).ToList(); vm.City = _areas.Where(p => p.BaseAreaId == vm.BusinessInfo.BaseAreaId).FirstOrDefault() ?? new BaseArea(); vm.Citys = _areas.Where(p => p.Grade == 2 && p.FId == vm.City.FId).ToList(); vm.Lines = _baseLineService.GetAll(); vm.Stations = vm.Id > 0 ? _baseStationService.GetAll().Where(p => p.BaseLineId == vm.BusinessInfo.BaseLineId).ToList() : new System.Collections.Generic.List <BaseStation>(); vm.ImgInfo = vm.BusinessInfo.BaseImage ?? new BaseImage(); if (vm.BusinessInfo.BusinessInfoId > 0) { vm.BusinessGroupList = _businessGroupService.GetAll().Where(p => p.BusinessTypeId == vm.BusinessInfo.BusinessTypeId).ToList(); } return(View(vm)); }
/// <summary> /// 编辑 /// </summary> /// <param name="_stationVM"></param> /// <returns></returns> public ActionResult Edit(BaseStationVM _stationVM) { _stationVM.Station = _baseStationService.GetById(_stationVM.Id) ?? new BaseStation(); _stationVM.Provinces = _baseAreaService.GetAll().Where(p => p.Grade == 1).ToList(); _stationVM.City = _baseAreaService.GetById(_stationVM.Station.BaseAreaId) ?? new BaseArea(); _stationVM.Citys = _baseAreaService.GetAll().Where(p => p.FId == _stationVM.Station.BaseArea.FId).ToList(); _stationVM.Lines = _stationVM.Id > 0 ? _baseLineService.GetAll() : new System.Collections.Generic.List <BaseLine>(); return(View(_stationVM)); }
public JsonResult GetCityIdByLines(int cityId = 0) { var list = _baseLineService.GetAll().Where(p => p.BaseAreaId == cityId); list = (from p in list select new BaseLine { BaseLineId = p.BaseLineId, LineName = p.LineName, LineNumber = p.LineNumber }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }