I'm looking to do an easy way to do a login without using a web API. I would like to know if it's possible to do a login with a SQL query which is doing a verification in the user table to verify if the user is existing or not. Using SQL server and not SQLite
[HttpPost]
public IActionResult Verify(Teacher teacher)
{
// Select the user who is trying to connect
string select = "SELECT * FROM [Db2021QuizLandStudent].[TestManagement].[Teacher] WHERE Email='" + teacher.Email + "' AND Password='" + teacher.Password + "'";
// Update the date of the last connection
string update = "UPDATE [Db2021QuizLandStudent].[TestManagement].[Teacher] SET LastConnexion = CURRENT_TIMESTAMP WHERE Email='" + teacher.Email + "' AND Password='" + teacher.Password + "'";
string query = select + ";" + update;
connectionString();
con.Open();
SqlCommand com = new SqlCommand(query, con);
dr = com.ExecuteReader();
if (dr.Read())
{
con.Close();
return View("Test");
}
else
{
con.Close();
return View("Error");
}
}
I did something like that in ASP.NET and i would like to do something like that in XAMARINS.
Thanks advance for the help :D