用户表增加删除和获取所有的功能
This commit is contained in:
45
WorkStation.Server/Services/IBaseService.cs
Normal file
45
WorkStation.Server/Services/IBaseService.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using WorkStation.Share;
|
||||
|
||||
namespace WorkStation.Server.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 定义了一个基础服务接口,用于规范数据操作的标准方法
|
||||
/// </summary>
|
||||
/// <typeparam name="T">表示此接口将针对的具体实体类型</typeparam>
|
||||
public interface IBaseService<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步添加一个实体项到数据存储中
|
||||
/// </summary>
|
||||
/// <param name="entity">要添加的实体项</param>
|
||||
/// <returns>返回一个包含添加操作结果的ApiResponse对象</returns>
|
||||
Task<ApiResponse> AddAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 根据实体的ID异步删除一个实体项
|
||||
/// </summary>
|
||||
/// <param name="id">要删除实体项的标识ID</param>
|
||||
/// <returns>返回一个包含删除操作结果的ApiResponse对象</returns>
|
||||
Task<ApiResponse> DelateAsync(int id);
|
||||
|
||||
/// <summary>
|
||||
/// 异步更新一个实体项
|
||||
/// </summary>
|
||||
/// <param name="entity">包含更新后信息的实体项</param>
|
||||
/// <returns>返回一个包含更新操作结果的ApiResponse对象</returns>
|
||||
Task<ApiResponse> UpdateAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 根据实体的ID异步获取一个实体项的详细信息
|
||||
/// </summary>
|
||||
/// <param name="id">要获取实体项的标识ID</param>
|
||||
/// <returns>返回一个包含指定实体项信息的ApiResponse对象</returns>
|
||||
Task<ApiResponse> GetByIdAsync(int id);
|
||||
|
||||
/// <summary>
|
||||
/// 异步获取所有实体项的列表
|
||||
/// </summary>
|
||||
/// <returns>返回一个包含所有实体项列表的ApiResponse对象</returns>
|
||||
Task<ApiRespon<List<T>>> GetAllAsync();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user