50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Persistence.API;
|
||
|
||
/// <summary>
|
||
/// Интерфейс для API, предназначенного для работы со справочниками
|
||
/// </summary>
|
||
public interface IApiDictionaryElement<TDto> where TDto : class, new()
|
||
{
|
||
/// <summary>
|
||
/// Получить все данные справочника
|
||
/// </summary>
|
||
/// <param name="dictionaryKey">ключ справочника</param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<IEnumerable<TDto>> GetDataAsync(Guid dictionaryKey, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// Добавить элемент в справочник
|
||
/// </summary>
|
||
/// <param name="dictionaryKey">ключ справочника</param>
|
||
/// <param name="dto"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<Guid> AddAsync(Guid dictionaryKey, TDto dto, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// Изменить одну запись
|
||
/// </summary>
|
||
/// <param name="dictionaryKey">ключ справочника</param>
|
||
/// <param name="dictionaryElementKey">ключ элемента в справочнике</param>
|
||
/// <param name="dto"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<Guid> UpdateAsync(Guid dictionaryKey, Guid dictionaryElementKey, TDto dto, CancellationToken token);
|
||
|
||
/// <summary>
|
||
/// Удалить одну запись
|
||
/// </summary>
|
||
/// <param name="dictionaryKey">ключ справочника</param>
|
||
/// <param name="dictionaryElementKey">ключ элемента в справочнике</param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
Task<int> DeleteAsync(Guid dictionaryKey, Guid dictionaryElementKey, CancellationToken token);
|
||
}
|