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.
85 lines
3.3 KiB
85 lines
3.3 KiB
using OrderCriterias;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace ManagerInterfaces
|
|
{
|
|
/// <summary>
|
|
/// All methods to handle answers
|
|
/// /!\ all methods returns a task
|
|
/// </summary>
|
|
/// <typeparam name="T">a DTO, Entity or Model answer</typeparam>
|
|
public interface IAnswerManager<T>
|
|
{
|
|
/// <summary>
|
|
/// get the number of answers
|
|
/// </summary>
|
|
/// <returns>the number of answers</returns>
|
|
public int getNbAnswers();
|
|
/// <summary>
|
|
/// get a part of all answers
|
|
/// </summary>
|
|
/// <param name="nb">the actual page</param>
|
|
/// <param name="count">number of answers in a page</param>
|
|
/// <param name="orderCriteria">the order criteria</param>
|
|
/// <returns>
|
|
/// a set of the number of page and
|
|
/// all answers in the database for
|
|
/// the page nb (or null if the page
|
|
/// does not exist (<=> (nb-1)*count outside
|
|
/// boundaries (0, getNbElement()-1)))
|
|
/// </returns>
|
|
public Task<(int nbPages, IEnumerable<T>? answers)> getAnswers(int nb, int count, AnswerOrderCriteria orderCriteria = AnswerOrderCriteria.ById);
|
|
/// <summary>
|
|
/// get some answers that answer to a question
|
|
/// </summary>
|
|
/// <param name="id">the id of the question</param>
|
|
/// <returns>
|
|
/// a set of all answers that answer to this question
|
|
/// </returns>
|
|
public Task<IEnumerable<T>?> getAnswersByIdQuestion(int id);
|
|
/// <summary>
|
|
/// modified an answer with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the answer</param>
|
|
/// <param name="answer">an answer that contains all modified properties</param>
|
|
/// <returns>
|
|
/// the answer (modified) that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> updateAnswer(int id, T answer);
|
|
/// <summary>
|
|
/// delete an answer with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the answer</param>
|
|
/// <returns>
|
|
/// the answer deleted that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> removeAnswer(int id);
|
|
/// <summary>
|
|
/// delete an answer
|
|
/// </summary>
|
|
/// <param name="answer">the answer to delete</param>
|
|
/// <returns>the answer removed or null if there wasn't any</returns>
|
|
public Task<T?> removeAnswer(T answer);
|
|
/// <summary>
|
|
/// add an answer
|
|
/// </summary>
|
|
/// <param name="answer">the answer to add</param>
|
|
/// <returns>
|
|
/// the element that corresponde to
|
|
/// the answer added or the answer equal to this
|
|
/// answer if this answer was already added
|
|
/// </returns>
|
|
public Task<T> addAnswer(T answer);
|
|
/// <summary>
|
|
/// get an answer with an id
|
|
/// </summary>
|
|
/// <param name="id">the id of the answer</param>
|
|
/// <returns>
|
|
/// the answer that corresponde
|
|
/// to the id or null if there isn't any
|
|
/// </returns>
|
|
public Task<T?> getAnswer(int id);
|
|
}
|
|
} |