Academatica.Api/Academatica.Api.Users/Controllers/UsersController.cs
/// <summary>
/// Endpoint used to get user's ID from user's email if possible.
/// </summary>
/// <param name="email">User email.</param>
Endpoint used to get user's ID from user's email if possible.
Endpoint used to get user ' s ID from user ' s email if possible .
[HttpGet]
        [Route("id/{email}")]
        public async Task<IActionResult> FindUserByEmail([FromQuery] string email)
        {
            if (email == null)
            {
                return BadRequest("Email was null.");
            }
            var user = await _userManager.FindByEmailAsync(email);
            if (user == null)
            {
                return Ok(new FindUserByEmailResponseDto()
                {
                    Success = false,
                    UserId = null
                });
            }
            return Ok(new FindUserByEmailResponseDto()
            {
                Success = true,
                UserId = user.Id
            });
        }
[ HttpGet ] [ Route ( " " ) ] public async Task < IActionResult > FindUserByEmail ( [ FromQuery ] string email ) { if ( email == null ) { return BadRequest ( " " ) ; } var user = await _userManager . FindByEmailAsync ( email ) ; if ( user == null ) { return Ok ( new FindUserByEmailResponseDto ( ) { Success = false , UserId = null } ) ; } return Ok ( new FindUserByEmailResponseDto ( ) { Success = true , UserId = user . Id } ) ; }
Endpoint used to get user's ID from user's email if possible.
Endpoint used to get user ' s ID from user ' s email if possible .
string
[FromQuery]
email
None