shopping-assistant-api/ShoppingAssistantApi.Application/IRepositories/IBaseRepository.cs
2023-09-22 23:02:20 +03:00

21 lines
885 B
C#

using ShoppingAssistantApi.Domain.Common;
using System.Linq.Expressions;
namespace ShoppingAssistantApi.Application.IRepositories;
public interface IBaseRepository<TEntity> where TEntity : EntityBase
{
Task<TEntity> AddAsync(TEntity entity, CancellationToken cancellationToken);
Task<List<TEntity>> GetPageAsync(int pageNumber, int pageSize, CancellationToken cancellationToken);
Task<List<TEntity>> GetPageAsync(int pageNumber, int pageSize, Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
Task<bool> ExistsAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
Task<int> GetTotalCountAsync();
Task<int> GetCountAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
Task<TEntity> DeleteAsync(TEntity entity, CancellationToken cancellationToken);
}