make service async

This commit is contained in:
Фролов 2021-08-10 14:35:49 +05:00
parent 8102442f81
commit ddbf3ff2d5
2 changed files with 21 additions and 9 deletions

View File

@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
public interface ICrudService<Tdto>
where Tdto : Data.IId
{
int Delete(int id);
Tdto Get(int id);
IEnumerable<Tdto> GetAll(Expression<Func<object, bool>> predicate = null);
Tdto Insert(Tdto newItem);
IEnumerable<Tdto> InsertRange(IEnumerable<Tdto> newItems);
Tdto Update(Tdto item);
Task<Tdto> GetAsync(int id, CancellationToken token = default);
Task<Tdto> InsertAsync(Tdto newItem, CancellationToken token = default);
Task<IEnumerable<Tdto>> InsertRangeAsync(IEnumerable<Tdto> newItems, CancellationToken token = default);
Task<Tdto> UpdateAsync(Tdto item, CancellationToken token = default);
Task<int> DeleteAsync(int id, CancellationToken token = default);
Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token = default);
}
}

View File

@ -0,0 +1,12 @@
using AsbCloudApp.Data;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
public interface IWellSectionService: ICrudService<WellSectionDto>
{
Task<PaginationContainer<WellSectionDto>> GetAllByWellIdAsync(int idWell, int skip=0, int take=32, CancellationToken token = default);
}
}