public ActionResult Add(Epm_Material model) { ResultView <int> view = new ResultView <int>(); MaterialView material = new MaterialView(); #region 表单验证 if (!model.ProjectId.HasValue || model.ProjectId.Value == 0 || string.IsNullOrWhiteSpace(model.ProjectName)) { view.Flag = false; view.Message = "项目名称不能为空"; return(Json(view)); } #endregion //上传附件 string fileDataJsonFile = Request.Form["fileDataJsonFile"];//获取上传文件json字符串 List <Base_Files> files = new List <Base_Files>(); if (!string.IsNullOrWhiteSpace(fileDataJsonFile)) { files = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJsonFile);//将文件信息json字符 material.FileList = files; } string materialDetails = Request.Form["MaterialDetails"]; if (!string.IsNullOrWhiteSpace(materialDetails)) { material.MaterialDetails = JsonConvert.DeserializeObject <List <Epm_MaterialDetails> >(materialDetails); } Result <int> result = new Result <int>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { material.Epm_Material = model; result = proxy.AddMaterial(material); } return(Json(result.ToResultView())); }