Exemplo n.º 1
0
        public async Task <IActionResult> GetUser(Users body)
        {
            await this.db.Connection.OpenAsync();

            var query = new UserQueries(this.db);

            body.Password = CalculateMD5Hash(body.Password);

            var result = await query.FindOneByIdAsync(body.Email, body.Password);

            if (result == null)
            {
                return(BadRequest("Invalid username or password."));
            }
            var token = this.GetToken(result);

            return(new OkObjectResult(token));
        }