コード例 #1
0
        public NccPage Update(NccPage entity)
        {
            var oldEntity = _entityRepository.Get(entity.Id);

            if (oldEntity != null)
            {
                oldEntity.ModificationDate = DateTime.Now;
                oldEntity.ModifyBy         = BaseModel.GetCurrentUserId();
                using (var txn = _entityRepository.BeginTransaction())
                {
                    CopyNewData(entity, oldEntity);
                    _entityRepository.Edit(oldEntity);
                    _entityRepository.SaveChange();
                    txn.Commit();
                }
            }

            return(entity);
        }
コード例 #2
0
        public NccPage Update(NccPage entity)
        {
            var oldEntity = _entityRepository.Get(entity.Id, false, new List <string> {
                "Parent", "PageDetails"
            });

            if (oldEntity != null)
            {
                oldEntity.ModificationDate = DateTime.Now;
                oldEntity.ModifyBy         = GlobalContext.GetCurrentUserId();
                using (var txn = _entityRepository.BeginTransaction())
                {
                    CopyNewData(entity, oldEntity);
                    _entityRepository.Edit(oldEntity);
                    _entityRepository.SaveChange();
                    txn.Commit();
                }
            }

            return(entity);
        }