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.
81 lines
3.1 KiB
81 lines
3.1 KiB
using OrderCriterias;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace ManagerInterfaces
|
|
{
|
|
/// <summary>
|
|
/// All methods to handle answers
|
|
/// </summary>
|
|
/// <typeparam name="T">a DTO or Entity type answer</typeparam>
|
|
public interface IAnswerManager<T>
|
|
{
|
|
/// <summary>
|
|
/// get the number of T element
|
|
/// </summary>
|
|
/// <returns>the number of T element</returns>
|
|
abstract int getNbElement();
|
|
/// <summary>
|
|
/// get a part of all answers
|
|
/// </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>
|
|
/// all T element of the database for
|
|
/// this page (or null if (nb-1)*count
|
|
/// is outside boundaries (0, getNbElement()-1)
|
|
/// </returns>
|
|
public Task<(int nbAnswers, ReadOnlyCollection<T>? answers)> getAnswers(int nb, int count, AnswerOrderCriteria orderCriteria = AnswerOrderCriteria.ById);
|
|
/// <summary>
|
|
/// get a T element with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the T element question</param>
|
|
/// <returns>
|
|
/// a set of all T element that correspond to this question
|
|
/// </returns>
|
|
public Task<ReadOnlyCollection<T>?> getAnswersByIdQuestion(long id);
|
|
/// <summary>
|
|
/// modified a T element with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the T element</param>
|
|
/// <param name="answer">an answer that contains all modified properties</param>
|
|
/// <returns>
|
|
/// the T element (modified) that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> modifierAnswer(long id, T answer);
|
|
/// <summary>
|
|
/// delete a T element with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the T element</param>
|
|
/// <returns>
|
|
/// the T element deleted that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> supprimerAnswer(long id);
|
|
/// <summary>
|
|
/// delete a T element
|
|
/// </summary>
|
|
/// <param name="answer">the T element to delete</param>
|
|
public Task supprimerAnswer(T answer);
|
|
/// <summary>
|
|
/// add a T element
|
|
/// </summary>
|
|
/// <param name="answer">the answer to add</param>
|
|
/// <returns>
|
|
/// the T element (modified) that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T> ajouterAnswer(T answer);
|
|
/// <summary>
|
|
/// get a T element with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the T element</param>
|
|
/// <returns>
|
|
/// the T element that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> getAnswer(long id);
|
|
}
|
|
}
|