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 questions /// /// the number of questions public int getNbQuestions(); /// /// add a question /// /// the question to add /// the question added public Task addQuestion(T question); /// /// delete a question /// /// the question to remove /// /// the question deleted or /// null if there isn't any /// public Task removeQuestion(T question); /// /// delete a question with an id /// /// the id of the question /// /// the question deleted that corresponde /// to the id or null if there isn't any /// public Task removeQuestion(int id); /// /// get a part of all questions /// /// the actual page /// number of question in a page /// the order criteria /// /// a set of the number of page and /// all questions 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 question with an id /// /// the id of the question /// /// the question that corresponde /// to the id or null if there isn't any /// public Task getQuestion(int id); /// /// get a question with a content /// /// the content of the question /// /// the question that corresponde /// to the content or null if there isn't any /// public Task getQuestion(string content); /// /// modified a question with an id /// /// the id of the question /// an question that contains all modified properties /// /// the question modified that corresponde /// to the id or null if there isn't any /// public Task updateQuestion(int id, T question); /// /// increase nbFalls of a question by 1 /// (and change the difficulty of the question) /// /// the id of the question /// /// the question modified that corresponde /// to the id or null if there isn't any /// public Task updateQuestionNbFalls(int 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 question in a page /// the order criteria /// /// a set of the number of page and /// all questions 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); } }