using AsbCloudApp.Data; using AsbCloudApp.Services; using AsbCloudDb.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mapster; using Microsoft.EntityFrameworkCore; using System.Threading.Tasks; using System.Threading; namespace AsbCloudInfrastructure.Services { public class WellSectionService: IWellSectionService { private readonly IAsbCloudDbContext context; private readonly DbSet dbSet; public WellSectionService(IAsbCloudDbContext context) { this.context = context; dbSet = context.Set(); } public Task GetAsync(int id, CancellationToken token = default) { throw new NotImplementedException(); } public Task InsertAsync(WellSectionDto newItem, CancellationToken token = default) { throw new NotImplementedException(); } public Task> InsertRangeAsync(IEnumerable newItems, CancellationToken token = default) { throw new NotImplementedException(); } public Task UpdateAsync(WellSectionDto item, CancellationToken token = default) { throw new NotImplementedException(); } public async Task> GetAllByWellIdAsync(int idWell, int skip, int take, CancellationToken token = default) { var query = dbSet .Include(s => s.WellSectionType) .Where(s => s.IdWell == idWell) .AsNoTracking(); var result = new PaginationContainer { Skip = skip, Take = take, Count = await query.CountAsync(token).ConfigureAwait(false), }; query = query .OrderBy(e => e.WellDepthPlan); if (skip > 0) query = query.Skip(skip); query = query.Take(take); var entities = await query.Take(take).ToListAsync(token).ConfigureAwait(false); foreach (var item in entities) result.Items.Add(item.Adapt()); return result; } public Task DeleteAsync(int id, CancellationToken token = default) { throw new NotImplementedException(); } public Task DeleteAsync(IEnumerable ids, CancellationToken token = default) { throw new NotImplementedException(); } } }