public async Task <ActionResult> SaveModify(WorkOrderGradeViewModel model) { using (WorkOrderGradeServiceClient client = new WorkOrderGradeServiceClient()) { WorkOrderGradeKey key = new WorkOrderGradeKey() { MaterialCode = model.MaterialCode, OrderNumber = model.OrderNumber, Grade = model.Grade }; MethodReturnResult <WorkOrderGrade> result = await client.GetAsync(key); if (result.Code == 0) { result.Data.ItemNo = model.ItemNo ?? 0; result.Data.MixColor = model.MixColor; result.Data.MixPowerset = model.MixPowerset; result.Data.MixSubPowerset = model.MixSubPowerset; result.Data.PackageGroup = model.PackageGroup; result.Data.IsUsed = model.IsUsed; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(ZPVMResources.StringResource.WorkOrderGrade_SaveModify_Success , key); } return(Json(rst)); } return(Json(result)); } }
// // GET: /ZPVM/WorkOrderGrade/Modify public async Task <ActionResult> Modify(string OrderNumber, string MaterialCode, string grade) { WorkOrderGradeViewModel viewModel = new WorkOrderGradeViewModel(); using (WorkOrderGradeServiceClient client = new WorkOrderGradeServiceClient()) { MethodReturnResult <WorkOrderGrade> result = await client.GetAsync(new WorkOrderGradeKey() { MaterialCode = MaterialCode, OrderNumber = OrderNumber, Grade = grade }); if (result.Code == 0) { viewModel = new WorkOrderGradeViewModel() { MaterialCode = result.Data.Key.MaterialCode, OrderNumber = result.Data.Key.OrderNumber, Grade = result.Data.Key.Grade, PackageGroup = result.Data.PackageGroup, MixSubPowerset = result.Data.MixSubPowerset, MixPowerset = result.Data.MixPowerset, MixColor = result.Data.MixColor, ItemNo = result.Data.ItemNo, IsUsed = result.Data.IsUsed, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_ModifyPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_ModifyPartial", new WorkOrderGradeViewModel())); }