Search Results for

    Show / Hide Table of Contents

    Class UserService

    Provides user management operations for the OEMS system.

    Inheritance
    object
    UserService
    Implements
    IUserService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OEMS.Core.Application.ApplicationServices
    Assembly: OEMS.Core.dll
    Syntax
    public class UserService : IUserService

    Constructors

    UserService(IUserRepository, IOrganisationUserRepository, IDbContextFactory<OEMSDBContext>)

    Initializes a new instance of the UserService class.

    Declaration
    public UserService(IUserRepository userRepository, IOrganisationUserRepository organisationUserRepository, IDbContextFactory<OEMSDBContext> contextFactory)
    Parameters
    Type Name Description
    IUserRepository userRepository

    The user repository for data access operations.

    IOrganisationUserRepository organisationUserRepository

    The organization user repository for organization membership operations.

    IDbContextFactory<OEMSDBContext> contextFactory

    The DbContext factory for creating separate contexts to avoid concurrency issues.

    Methods

    AssignRoleAsync(Guid, string)

    Assigns a role to a user.

    Declaration
    public Task AssignRoleAsync(Guid userId, string role)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    string role

    The role to assign to the user.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    ChangeDisplayNameAsync(Guid, string)

    Changes the display name of a user.

    Declaration
    public Task ChangeDisplayNameAsync(Guid userId, string newName)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    string newName

    The new display name for the user.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    CreateUserAsync(CreateUserDto)

    Creates a new user in the system.

    Declaration
    public Task<Guid> CreateUserAsync(CreateUserDto dto)
    Parameters
    Type Name Description
    CreateUserDto dto

    The user creation data transfer object containing user information.

    Returns
    Type Description
    Task<Guid>

    A task that represents the asynchronous operation. The task result contains the newly created user's identifier.

    DeleteUserAsync(Guid)

    Deletes a user from the system.

    Declaration
    public Task DeleteUserAsync(Guid userId)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user to delete.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    GetOrganisationUserByIdAsync(Guid, Guid)

    Retrieves a specific user's membership information within an organization.

    Declaration
    public Task<MemberDto> GetOrganisationUserByIdAsync(Guid userId, Guid orgaId)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    Guid orgaId

    The unique identifier of the organization.

    Returns
    Type Description
    Task<MemberDto>

    A task that represents the asynchronous operation. The task result contains the member data transfer object.

    GetUserByEmailAsync(string)

    Retrieves a user by their email address.

    Declaration
    public Task<UserDto> GetUserByEmailAsync(string email)
    Parameters
    Type Name Description
    string email

    The email address of the user.

    Returns
    Type Description
    Task<UserDto>

    A task that represents the asynchronous operation. The task result contains the user data transfer object.

    GetUserByIdAsync(Guid)

    Retrieves a user by their unique identifier.

    Declaration
    public Task<UserDto> GetUserByIdAsync(Guid userId)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    Returns
    Type Description
    Task<UserDto>

    A task that represents the asynchronous operation. The task result contains the user data transfer object.

    GetUsersByOrganizationAsync(Guid)

    Retrieves all users belonging to a specific organization.

    Declaration
    public Task<IEnumerable<UserDto>> GetUsersByOrganizationAsync(Guid organizationId)
    Parameters
    Type Name Description
    Guid organizationId

    The unique identifier of the organization.

    Returns
    Type Description
    Task<IEnumerable<UserDto>>

    A task that represents the asynchronous operation. The task result contains a collection of user data transfer objects.

    RemoveRoleAsync(Guid, string)

    Removes a role from a user.

    Declaration
    public Task RemoveRoleAsync(Guid userId, string role)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    string role

    The role to remove from the user.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    UpdateUserAsync(UpdateUserDto)

    Updates an existing user's information.

    Declaration
    public Task UpdateUserAsync(UpdateUserDto dto)
    Parameters
    Type Name Description
    UpdateUserDto dto

    The user update data transfer object containing updated user information.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    UploadProfilePictureAsync(Guid, FileDto)

    Uploads a profile picture for a user.

    Declaration
    public Task UploadProfilePictureAsync(Guid userId, FileDto file)
    Parameters
    Type Name Description
    Guid userId

    The unique identifier of the user.

    FileDto file

    The file data transfer object containing the profile picture information.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    Implements

    IUserService
    In this article
    Back to top Generated by DocFX