This commit is contained in:
Фролов 2021-08-20 13:59:30 +05:00
parent 6db671f955
commit 322208e2b5

View File

@ -160,72 +160,6 @@ namespace AsbCloudInfrastructure.Services
dto.SectionType = entity.WellSectionType.Caption;
return dto;
}
//public async Task<WellSectionDto> InsertAsync(WellSectionDto item, int idWell, CancellationToken token = default)
//{
// var sectionType = await GetWellSectionTypeFromCacheAndAssertAsync(item.SectionType);
// var entity = item.Adapt<WellSection>();
// entity.Id = default;
// entity.IdWell = idWell;
// entity.IdWellSectionType = sectionType.Id;
// var dbEntity = dbSet.Add(entity);
// await context.SaveChangesAsync(token).ConfigureAwait(false);
// var dto = dbEntity.Entity.Adapt<WellSectionDto>();
// dto.SectionType = sectionType.Caption;
// return dto;
//}
//public async Task<IEnumerable<WellSectionDto>> InsertRangeAsync(int idWell, IEnumerable<WellSectionDto> items, CancellationToken token = default)
//{
// var dbEntities = new Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<WellSection>[items.Count()];
// for (int i = 0; i < dbEntities.Length; i++)
// {
// var sectionType = await GetWellSectionTypeFromCacheAndAssertAsync(items.ElementAt(i).SectionType, token);
// var item = items.ElementAt(i).Adapt<WellSection>();
// item.IdWell = idWell;
// item.IdWellSectionType = sectionType.Id;
// dbEntities[i] = dbSet.Add(item);
// }
// await context.SaveChangesAsync(token).ConfigureAwait(false);
// var dtos = dbEntities.Select((e) => {
// var dto = e.Entity.Adapt<WellSectionDto>();
// var sectionType = cachedSectionsTypes.FirstOrDefault(s => s.Id == e.Entity.IdWellSectionType);
// dto.SectionType = sectionType.Caption;
// return dto;
// });
// return dtos;
//}
//public async Task<WellSectionDto> UpdateAsync(int idWell, int idSection, WellSectionDto item, CancellationToken token = default)
//{
// var sectionType = await GetWellSectionTypeFromCacheAndAssertAsync(item.SectionType, token)
// .ConfigureAwait(false);
// var entity = item.Adapt<WellSection>();
// entity.Id = idSection;
// entity.IdWell = idWell;
// entity.IdWellSectionType = sectionType.Id;
// var dbEntity = dbSet.Update(entity);
// await context.SaveChangesAsync(token).ConfigureAwait(false);
// var dto = dbEntity.Entity.Adapt<WellSectionDto>();
// dto.SectionType = sectionType.Caption;
// return dto;
//}
//public Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token = default)
//{
// var entities = dbSet.Where(e => ids.Contains(e.Id));
// dbSet.RemoveRange(entities);
// return context.SaveChangesAsync(token);
//}
private static PaginationContainer<Tdto> PaginateData<Tdto, TEntity>(IEnumerable<IGrouping<int, TEntity>> groupedCollection,
int skip, int take)
{