/// <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)); }
public JsonResult GetLineIdByStations(int lineId = 0) { var list = _baseStationService.GetAll().Where(p => p.BaseLineId == lineId); list = (from p in list select new BaseStation { BaseLineId = p.BaseLineId, BaseAreaId = p.BaseAreaId, Name = p.Name, BaseStationId = p.BaseStationId }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }