/// <summary> /// 列表 /// </summary> /// <param name="pn">分页下标</param> /// <returns></returns> public ActionResult List(DishesLabelVM vm, int pn = 1) { //查询 var data = _dishesService.GetById(vm.Id); vm.BusinessInfoId = data.BusinessInfoId; vm.DishesLabelList = data.DishesLableList; return(View(vm)); }
/// <summary> /// 编辑 /// </summary> /// <returns></returns> public ActionResult Edit(DishesLabelVM vm) { vm.DishesLabel = _dishesLabelService.GetById(vm.Id) ?? new DishesLable(); if (vm.Id == 0) { var data = _dishesService.GetById(vm.DishesId); vm.BusinessInfoId = data.BusinessInfoId; } else { vm.DishesId = vm.DishesLabel.DishesId; vm.BusinessInfoId = vm.DishesLabel.BusinessInfoId; } //获取默认可选标签列表 vm.DishesLabelList = _dishesLabelService.GetAll().Where(p => p.BusinessInfoId == 0 || p.BusinessInfoId == vm.BusinessInfoId).Distinct().ToList(); return(View(vm)); }