Last ...
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// an Interface for Base RepositoryService Actions Providing Using Controllers ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public interface IXBaseServiceController<TEntity, TDto, TKey>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
where TDto : XBaseEntityDto<TKey>
|
||||
{
|
||||
//
|
||||
IXBaseRepositoryService<TEntity, TDto, TKey> RepositoryService { get; }
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> DefaultOrderBuilder { get; }
|
||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> DefaultIncludeBuilder { get; }
|
||||
|
||||
//
|
||||
#region Add ...
|
||||
Task<ActionResult<TDto>> Add(
|
||||
TDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<TDto>> AddOrUpdate(
|
||||
TDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult> AddMany(
|
||||
XBaseRangeRequest<TDto> request,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Retrieve ...
|
||||
Task<ActionResult<TDto>> Get(
|
||||
[FromRoute] TKey id,
|
||||
[FromQuery] bool ignoreSoftDeleteds = true,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<IEnumerable<TDto>>> GetAll(
|
||||
[FromQuery] bool ignoreSoftDeleteds = true,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<TDto>> FindOne(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool ignoreSoftDeleteds = true,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<IEnumerable<TDto>>> FindMany(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool ignoreSoftDeleteds = true,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<XQueryResult<TDto>>> Query(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool ignoreSoftDeleteds = true,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Update ...
|
||||
Task<ActionResult<TDto>> Update(
|
||||
[FromRoute] TKey id,
|
||||
[FromBody] TDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult<bool>> UpdateMany(
|
||||
[FromBody] XBaseRangeRequest<TDto> request,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Exists ...
|
||||
Task<ActionResult<bool>> IsExists(
|
||||
[FromRoute] TKey id,
|
||||
[FromQuery] bool ignoreSoftDeletedss = true,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Remove ...
|
||||
Task<ActionResult<TDto>> Remove(
|
||||
[FromRoute] TKey id,
|
||||
[FromQuery] bool softDelete = true,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
Task<ActionResult> RemoveMany(
|
||||
[FromBody] XBaseRangeRequest<TDto> request,
|
||||
[FromQuery] bool softDelete = true,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user