Ejemplo n.º 1
0
        public IActionResult Authenticate([FromBody] AuthenticatePostModel model)
        {
            var user = _userService.Authenticate(model.Username, model.Password);

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

            return(Ok(user));
        }
        public IActionResult Authenticate([FromBody] AuthenticatePostModel model)
        {
            var response = _userService.Authenticate(model.Username, model.Password);

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

            var userToReturn = _mapper.Map <UserWithToken>(response);

            return(Ok(userToReturn));
        }