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.
77 lines
3.1 KiB
77 lines
3.1 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 administrators
|
|
/// /!\ all methods returns a task
|
|
/// </summary>
|
|
/// <typeparam name="T">a DTO, Entity or Model administrator</typeparam>
|
|
public interface IAdministratorManager<T>
|
|
{
|
|
/// <summary>
|
|
/// get the number of T element
|
|
/// </summary>
|
|
/// <returns>the number of T element</returns>
|
|
public int getNbElements();
|
|
/// <summary>
|
|
/// add a T element
|
|
/// </summary>
|
|
/// <param name="admin">the administrator to add</param>
|
|
/// <returns>
|
|
/// the T element that corresponde to
|
|
/// the administrator added or the administrator equal to this
|
|
/// administrator if this administrator was already added
|
|
/// </returns>
|
|
public Task<T> addAdmin(T admin);
|
|
/// <summary>
|
|
/// remove a T element
|
|
/// </summary>
|
|
/// <param name="admin">the administrator to remove</param>
|
|
/// <returns>the administrator removed or null if there isn't any</returns>
|
|
public Task<T?> removeAdmin(T admin);
|
|
/// <summary>
|
|
/// remove a T element
|
|
/// </summary>
|
|
/// <param name="id">the id of the administrator to remove</param>
|
|
/// <returns>the administrator removed or null if there isn't any</returns>
|
|
public Task<T?> removeAdmin(int id);
|
|
/// <summary>
|
|
/// get a part of all administrators
|
|
/// </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, ReadOnlyCollection<T>? administrators)> getAdministrators(int nb, int count, AdministratorOrderCriteria orderCriteria = AdministratorOrderCriteria.ById);
|
|
/// <summary>
|
|
/// get an administrator by his username
|
|
/// </summary>
|
|
/// <param name="username">the username of the administrator</param>
|
|
/// <returns>the administrator that corresponde or null if there isn't any</returns>
|
|
public Task<T?> getAdministratorByUsername(string username);
|
|
/// <summary>
|
|
/// set the password of an administrator
|
|
/// </summary>
|
|
/// <param name="username">the username of the administrator</param>
|
|
/// <param name="newHashedPassword">the hash of the new password</param>
|
|
/// <returns>
|
|
/// true if the password was sucessful change
|
|
/// false otherwise (no administrator with this username
|
|
/// </returns>
|
|
public Task<bool> setPassword(string username, string newHashedPassword);
|
|
}
|
|
}
|