示例#1
0
        /// <summary>
        /// 添加或更新ApplyStageVersion 数据
        /// </summary>
        /// <param name="versionEntity"></param>
        public void SaveApplyStageVersion(ApplyStageVersionEntity versionEntity)
        {
            if (versionEntity.VersionID == Guid.Empty)  //如果传入的Guid全为0,则为添加一新Guid
                versionEntity.VersionID = Guid.NewGuid();

            ApplyStageVersionEntity originVersionEntity = context.ApplyStageVersion
                .SingleOrDefault(a => a.VersionID == versionEntity.VersionID || a.VersionName == versionEntity.VersionName);
            if (originVersionEntity == null)
                context.ApplyStageVersion.Add(versionEntity);
            else
                context.Entry(originVersionEntity).CurrentValues.SetValues(versionEntity);

            context.SaveChanges();
        }
 public JsonResult VersionEdit(ApplyStageVersionEntity ajaxData)
 {
     if (ajaxData.SignDateBefore == null)
         return Json(new { SaveResult = false });
     else
     {
         repository.SaveApplyStageVersion(ajaxData);
         return Json(new { SaveResult = true });
     }
 }