Exemplo n.º 1
0
        public T Insert(T t)
        {
            var entity = _repository.Insert(_transformer.ToProviderData(t));

            SaveChanges();
            return(_transformer.ToModel(entity));
        }
        public virtual OperationResult <TModel> Insert(TModel t)
        {
            if (t is IChangeTrackable)
            {
                ((IChangeTrackable)t).CreatedDate = DateTime.Now;
                ((IChangeTrackable)t).UpdatedDate = DateTime.Now;
            }
            if (t is IPreservable)
            {
                ((IPreservable)t).IsDeleted = false;
            }

            var data = _repository.Insert(_transformer.ToProviderData(t));

            return(OperationResult.From(_transformer.ToModel(data)));
        }