public async Task <IActionResult> AppLogin(LoginViewModel model) { ParentModule module = new ParentModule(_context); if (ModelState.IsValid) { // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, set lockoutOnFailure: true var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure : false); if (result.Succeeded) { _logger.LogInformation(1, "User logged in."); UserModule module1 = new UserModule(_context, _userManager, _signInManager); Users user = new Users { Email = model.Email }; string userid = module1.GetUserInfo(user).Id; //select userID if (userid.Length == 0) { return(NotFound()); } List <Parent> item = module.GetParentInfo2(userid); var resultToken = GetToken(model); return(CreatedAtAction("Get", new { Successed = true, statusCode = 200, tokenResult = resultToken, item })); //return Json(item); } } // If we got this far, something failed, redisplay form return(BadRequest()); }