Example #1
0
 /// <summary>
 /// insert
 /// </summary>
 /// <param name="sysAreaPost">Model</param>
 /// <param name="ErrorMsg">Result</param>
 /// <returns></returns>
 public bool Create(SysAreaPost sysAreaPost, ref string ErrorMsg)
 {
     try
     {
         SysArea sysArea = new SysArea();
         LinqHelper.ModelTrans(sysAreaPost, sysArea);
         sysArea.ObjectId         = ResultHelper.NewId;
         sysArea.CreateTime       = ResultHelper.NowTime;
         sysArea.ModificationTime = ResultHelper.NowTime;
         SysArea sysArea1 = new SysArea();
         sysArea1.ObjectId = "202008131744238122763d1e7363908";
         LinqHelper.ModelTrans(sysAreaPost, sysArea1);
         sysArea1.CreateTime       = ResultHelper.NowTime;
         sysArea1.ModificationTime = ResultHelper.NowTime;
         SysArea sysArea2 = new SysArea();
         LinqHelper.ModelTrans(sysAreaPost, sysArea2);
         sysArea2.ObjectId         = ResultHelper.NewId;
         sysArea2.CreateTime       = ResultHelper.NowTime;
         sysArea2.ModificationTime = ResultHelper.NowTime;
         sysAreaRepository.CreateTransaction(sysArea);
         sysAreaRepository.CreateTransaction(sysArea1);
         sysAreaRepository.CreateTransaction(sysArea2);
         sysAreaRepository.TransactionCommit();
         return(true);
     }
     catch (Exception ex)
     {
         ErrorMsg = "Create Error";
         return(false);
     }
 }
        public IActionResult Update([FromBody] SysAreaPost sysAreaPost)
        {
            string ErrorMsg = string.Empty;

            sysAreaPost.ModificationUserName = GetOperationId();
            var flag = sysAreaService.Update(sysAreaPost, ref ErrorMsg);

            if (flag)
            {
                return(new JsonResult(
                           ResponseHelper.IsSuccess_Msg_Data_HttpCode(ErrorMsg, flag)
                           ));
            }
            else
            {
                return(new JsonResult(
                           ResponseHelper.Error_Msg_Ecode_Elevel_HttpCode(ErrorMsg, flag)
                           ));
            }
        }
Example #3
0
 /// <summary>
 /// update
 /// </summary>
 /// <param name="sysAreaPost">Model</param>
 /// <param name="ErrorMsg">Result</param>
 /// <returns></returns>
 public bool Update(SysAreaPost sysAreaPost, ref string ErrorMsg)
 {
     try
     {
         SysArea sysArea = new SysArea();
         LinqHelper.ModelTrans(sysAreaPost, sysArea);
         sysArea.ModificationTime = ResultHelper.NowTime;
         if (sysAreaRepository.EditNotNull(sysArea))
         {
             ErrorMsg = "Update Success";
             return(true);
         }
         else
         {
             ErrorMsg = "Update Faild";
             return(false);
         }
     }
     catch (Exception ex)
     {
         ErrorMsg = "Update Error";
         return(false);
     }
 }