public async Task <ActionResult> SaveModify(ProductControlObjectViewModel model) { using (ProductControlObjectServiceClient client = new ProductControlObjectServiceClient()) { ProductControlObjectKey key = new ProductControlObjectKey() { ProductCode = model.ProductCode, CellEff = model.CellEff, SupplierCode = model.SupplierCode, Type = model.Type, Object = model.Object }; MethodReturnResult <ProductControlObject> result = await client.GetAsync(key); if (result.Code == 0) { result.Data.ProductName = model.ProductName; result.Data.SupplierName = model.SupplierName; result.Data.Value = model.Value; 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.ProductControlObject_SaveModify_Success , key); } return(Json(rst)); } return(Json(result)); } }
// // GET: /ZPVM/ProductControlObject/Modify public async Task <ActionResult> Modify(string ProductCode, string CellEff, string SupplierCode, EnumPVMTestDataType obj, string type) { ProductControlObjectViewModel viewModel = new ProductControlObjectViewModel(); using (ProductControlObjectServiceClient client = new ProductControlObjectServiceClient()) { MethodReturnResult <ProductControlObject> result = await client.GetAsync(new ProductControlObjectKey() { ProductCode = ProductCode, CellEff = CellEff, SupplierCode = SupplierCode, Object = obj, Type = type }); if (result.Code == 0) { viewModel = new ProductControlObjectViewModel() { ProductCode = result.Data.Key.ProductCode, CellEff = result.Data.Key.CellEff, SupplierCode = result.Data.Key.SupplierCode, ProductName = result.Data.ProductName, SupplierName = result.Data.SupplierName, Value = result.Data.Value, Type = result.Data.Key.Type, Object = result.Data.Key.Object, 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 ProductControlObjectViewModel())); }