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.
3.01-QCM_MuscuMaths/WebApi/ManagerInterfaces/ILobbyManager.cs

71 lines
2.4 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 lobbies
/// /!\ all methods returns a task
/// </summary>
/// <typeparam name="T">a DTO, Entity or Model lobby</typeparam>
public interface ILobbyManager<T>
{
/// <summary>
/// get the number of T element
/// </summary>
/// <returns>the number of T element</returns>
public int getNbElements();
/// <summary>
/// add a lobby
/// </summary>
/// <param name="lobby">the lobby to add</param>
/// <returns>the lobby added</returns>
public Task<T> addLobby(T lobby);
/// <summary>
/// delete a T element
/// </summary>
/// <param name="lobby">the lobby to remove</param>
/// <returns>
/// the T element deleted or
/// null if there isn't any
/// </returns>
public Task<T?> removeLobby(T lobby);
/// <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?> removeLobby(uint id);
/// <summary>
/// get a part of all lobbies
/// </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>
public Task<(int nbPages, IEnumerable<T>? lobbies)> getLobbies(int nb, int count, LobbyOrderCriteria orderCriteria = LobbyOrderCriteria.ById);
/// <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?> getLobby(uint id);
}
}