Esempio n. 1
0
 private void _Save(TEntity entity)
 {
     if (entity.Id == 0)
     {
         entity.CreateDate = DateTime.Now;
         entity.CreatedBy  = GlobalVars.CurrAdminId;
         entity.IsDeleted  = false;
         _context.GetTable <TEntity>().Add(entity);
     }
     else
     {
         entity.ModifyDate = DateTime.Now;
         entity.ModifiedBy = GlobalVars.CurrAdminId > 0 ? GlobalVars.CurrAdminId : entity.ModifiedBy;
         _context.Entry <TEntity>(entity).State = EntityState.Modified;
     }
 }
Esempio n. 2
0
        private void _Save(TEntity entity)
        {
            if (entity.Id == 0)
            {
                entity.CreateDate = DateTime.Now;
                entity.IsDeleted  = false;
                _context.GetTable <TEntity>().Add(entity);

                LogTransaction(entity, TransactionLogStatus.Save);
            }
            else
            {
                entity.ModifyDate = DateTime.Now;
                _context.Entry <TEntity>(entity).State = EntityState.Modified;

                LogTransaction(entity, TransactionLogStatus.Update);
            }
        }