public async Task <IActionResult> Login(string Username, string Password) { string _password = SecuritySystem.Encrypt(Password); var query = "SELECT * FROM [dbo].[users] where userid = '" + Username + "' and userpassword LIKE '" + _password + "' "; var user = await _context.Users.FromSql(query).ToListAsync(); //var user = await _context.Users // .FirstOrDefaultAsync(x => x.Userid == Username && x.Userpassword == _password); if (user.Count() == 0) { return(View("Index")); } else { //UserLogin = Username; //return RedirectToAction("Index", "Home", new { userid = Username }); return(View()); } }