Exemplo n.º 1
0
        public async Task <IActionResult> Authenticate([FromBody] UserDto userParam)
        {
            UserDtoWithoutPassword user = await _userService.Authenticate(userParam.Username, userParam.Password);

            if (user == null)
            {
                return(BadRequest(new { message = "Username or password is incorrect" }));
            }

            return(Ok(user));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Register([FromBody] UserDto userParam)
        {
            UserDtoWithoutPassword user = await _userService.Register(userParam);

            return(Ok(user));
        }