using OrderCriterias; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ManagerInterfaces { /// /// All methods to handle questions /// /!\ all methods returns a task /// /// a DTO, Entity or Model question public interface IQuestionManager { /// /// get the number of T element /// /// the number of T element public int getNbElements(); /// /// add a question /// /// the question to add /// the question added public Task addQuestion(T question); /// /// delete a T element /// /// the question to remove /// /// the T element deleted or /// null if there isn't any /// public Task removeQuestion(T question); /// /// delete a T element with an id /// /// the id of the T element /// /// the T element deleted that corresponde /// to the id or null if there isn't any /// public Task removeQuestion(uint id); /// /// get a part of all questions /// /// the actual page /// number of T element in a page /// the order criteria /// /// 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))) /// public Task<(int nbPages, IEnumerable? questions)> getQuestions(int nb, int count, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById); /// /// get a T element with an id /// /// the id of the T element /// /// the T element that corresponde /// to the id or null if there isn't any /// public Task getQuestion(uint id); /// /// modified a T element with an id /// /// the id of the T element /// an question that contains all modified properties /// /// the T element (modified) that corresponde /// to the id or null if there isn't any /// public Task updateQuestion(uint id, T question); /// /// increase nbFalls of a question by 1 /// (and change the difficulty of the question) /// /// the id of the question /// /// the T element (modified) that corresponde /// to the id or null if there isn't any /// public Task updateQuestionNbFalls(uint id); /// /// add some questions /// /// a set of questions to add /// questions added public Task> addQuestions(IEnumerable questions); /// /// get a part of all questions for a given chapter and a given difficulty /// /// the id of the chapter /// the difficulty /// the actual page /// number of T element in a page /// the order criteria /// /// 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))) /// or null if the chapter does not exist /// or the difficulty is not between 1 and 3 /// public Task<(int nbPages, IEnumerable? questions)?> getQuestionsByChapterAndDifficulty(int idChapter, int difficulty, int nb, int count, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById); } }