You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.6 KiB
76 lines
2.6 KiB
using OrderCriterias;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ManagerInterfaces
|
|
{
|
|
/// <summary>
|
|
/// All methods to handle chapters
|
|
/// /!\ all methods returns a task
|
|
/// </summary>
|
|
/// <typeparam name="T">a DTO, Entity or Model chapter</typeparam>
|
|
public interface IChapterManager<T>
|
|
{
|
|
/// <summary>
|
|
/// get the number of T element
|
|
/// </summary>
|
|
/// <returns>the number of T element</returns>
|
|
public int getNbElements();
|
|
/// <summary>
|
|
/// add a chapter
|
|
/// </summary>
|
|
/// <param name="chapter">chapter to add</param>
|
|
/// <returns>
|
|
/// the chapter added or the chapter that correspond
|
|
/// to it and that is already in the database
|
|
/// </returns>
|
|
Task<T> addChapter(T chapter);
|
|
/// <summary>
|
|
/// remove a chapter
|
|
/// </summary>
|
|
/// <param name="chapter">the chapter to remove</param>
|
|
/// <returns>
|
|
/// the chapter removed or null if
|
|
/// the chapter does not exist
|
|
/// </returns>
|
|
Task<T?> removeChapter(T chapter);
|
|
/// <summary>
|
|
/// remove a chapter
|
|
/// </summary>
|
|
/// <param name="id">the identifier of the chapter to remove</param>
|
|
/// <returns>
|
|
/// the chapter removed or null if
|
|
/// the chapter does not exist
|
|
/// </returns>
|
|
Task<T?> removeChapter(uint id);
|
|
/// <summary>
|
|
/// get a chapter
|
|
/// </summary>
|
|
/// <param name="id">the identifier of the chapter to remove</param>
|
|
/// <returns>
|
|
/// the chapter that correspond
|
|
/// to the id or null if the
|
|
/// chapter does not exist
|
|
/// </returns>
|
|
Task<T?> getChapter(uint id);
|
|
/// <summary>
|
|
/// get a part of all chapters
|
|
/// </summary>
|
|
/// <param name="nb">the actual page</param>
|
|
/// <param name="count">number of T element in a page</param>
|
|
/// <param name="orderCriteria">the order criteria</param>
|
|
/// <returns>
|
|
/// a set of the number of page and
|
|
/// all T element in the database for
|
|
/// the page nb (or null if the page
|
|
/// does not exist (<=> (nb-1)*count outside
|
|
/// boundaries (0, getNbElement()-1)))
|
|
/// </returns>
|
|
Task<(int nbPages, ReadOnlyCollection<T>? chapters)> getChapters(int nb, int count, ChapterOrderCriteria orderCriteria = ChapterOrderCriteria.ById);
|
|
}
|
|
}
|