Пример #1
0
        protected void Delete(IUpsertable record)
        {
            Upsert(new DeletedRecord
            {
                EntityName = record.GetType().Name,
                EntityPk   = record.Pk,
                UserFk     = Get <IBaseModelService>().User.Pk,
                IsNew      = true,
            });

            Get <IDatabaseConnection>().Connection.Delete(record);
        }
Пример #2
0
        protected void Upsert(IUpsertable record)
        {
            record.IsPending    = true;
            record.ModifiedDate = new DateTime(DateTime.Now.ToUniversalTime().Ticks / 10000 * 10000);

            if (record.IsNew)
            {
                Get <IDatabaseConnection>().Connection.Insert(record);
                record.IsNew = false;
            }
            else
            {
                Get <IDatabaseConnection>().Connection.Update(record);
            }
        }