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.
WF-PmAPI/WF_EF_Api/Shared/IUserService.cs

68 lines
2.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared
{
public interface IUserService<TUser>
{
// Retrieves a user by their unique identifier (id).
// 'id' is the unique identifier of the user.
Task<TUser> GetUserById(int id);
// Retrieves a user by their username.
// 'username' is the username of the user to be retrieved.
Task<TUser> GetUserByUsername(string username);
// Retrieves a user by their email address.
// 'email' is the email address of the user to be retrieved.
Task<TUser> GetUserByEmail(string email);
// Retrieves all users.
// This returns a list of users with pagination information (e.g., total count, page size).
Task<PaginationResult<TUser>> GetAllUser();
// Retrieves a subset of users based on the provided index and page size.
// 'index' is the starting point for pagination (page number).
// 'pageSize' is the number of users per page.
Task<PaginationResult<TUser>> GetSomeUser(int index, int pageSize);
// Adds a new user to the system.
// 'user' is the user object that will be added to the system.
Task AddUser(TUser user);
// Updates the details of an existing user identified by 'userId'.
// 'userId' is the ID of the user to be updated, and 'user' contains the new user data.
Task<TUser> UpdateUser(int userId, TUser user);
// Removes a user from the system based on their unique identifier ('userId').
// 'userId' is the unique identifier of the user to be removed.
Task RemoveUser(TUser user);
// Retrieves the hashed password for a given username.
// 'username' is the username for which the password hash is to be retrieved.
Task<string> GetHashPassword(string username);
// Checks if a username already exists.
// 'username' is the username to check for existence.
Task<bool> ExistUsername(string username);
// Checks if an email address already exists.
// 'email' is the email address to check for existence.
Task<bool> ExistEmail(string email);
// Sets the admin role for a user.
// 'isAdmin' is a boolean indicating whether the user should have admin privileges.
Task SetAdminRole(bool isAdmin);
// Retrieves the total count of users.
Task<int> CountUser();
// Retrieves the last user ID.
Task<int> GetLastUserId();
}
}