Esempio n. 1
0
 public ActionResult SaveForm(string keyValue, SafeProductEntity entity, [System.Web.Http.FromBody] string dataJson, [System.Web.Http.FromBody] string dataJson1)
 {
     if (safeproductbll.SaveForm(keyValue, entity) > 0)
     {
         //保存关联的从表记录(安全目标项目)
         if (dataJson.Length > 0)
         {
             SafeProductProjectBLL safeproductPbll = new SafeProductProjectBLL();
             if (safeproductPbll.Remove(entity.Id) > 0)
             {
                 List <SafeProductProjectEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafeProductProjectEntity> >(dataJson);
                 foreach (SafeProductProjectEntity data in list)
                 {
                     safeproductPbll.SaveForm("", data);
                 }
             }
         }
         //保存关联的从表记录(安全目标责任书)
         if (dataJson1.Length > 0)
         {
             SafeProductDutyBookBLL safeBookbll = new SafeProductDutyBookBLL();
             if (safeBookbll.Remove(entity.Id) > 0)
             {
                 List <SafeProductDutyBookEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafeProductDutyBookEntity> >(dataJson1);
                 foreach (SafeProductDutyBookEntity data in list)
                 {
                     safeBookbll.SaveForm("", data);
                 }
             }
         }
     }
     return(Success("操作成功。"));
 }
Esempio n. 2
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public int SaveForm(string keyValue, SafeProductEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }