Esempio n. 1
0
        public async Task <EntityContainer <T, TKey> > InsertMappedReusingDeleted <TModel>(TModel sourceModel, CancellationToken ct = default(CancellationToken))
        {
            var entity = _mapper.Map <T>(sourceModel);

            await InsertReusingDeletedAsync(entity, ct);

            return(EntityContainer <T, TKey> .FromEntity(entity));
        }
Esempio n. 2
0
        public async Task <List <EntityContainer <T, TKey> > > InsertMapped <TModel>(IEnumerable <TModel> sourceModel, CancellationToken ct = default(CancellationToken))
        {
            var entities = _mapper.Map <IEnumerable <T> >(sourceModel);

            await InsertAsync(entities, ct);

            return(entities.Select(x => EntityContainer <T, TKey> .FromEntity(x)).ToList());
        }
Esempio n. 3
0
        public async Task <EntityContainer <T, TKey> > UpdateAsync <TModel>(TKey id, TModel sourceModel, CancellationToken ct = default(CancellationToken))
        {
            var entity = await Entities.FindAsync(new object[] { id }, ct);

            _mapper.Map(sourceModel, entity);
            await UpdateAsync(entity);

            return(EntityContainer <T, TKey> .FromEntity(entity));
        }