public async Task <IActionResult> Login([FromBody] LoginViewModel loginViewModel) { var result = await _identityLogic.Login(loginViewModel); // Set session values if (result != null) { HttpContext.Session.SetString(ApiConstants.Username, result.Username); HttpContext.Session.SetString(ApiConstants.PasswordHash, result.PasswordHash); HttpContext.Session.SetString(ApiConstants.Authenticated.Key, ApiConstants.Authenticated.Value); return(Ok($"Successfully logged-in {result.Username}")); } return(BadRequest($"Failed to log-in {loginViewModel?.Username}")); }