public bool IsvalidUser(string ID, string Password)
{
Connectionstring = Class_String.con;
if (ID.Length == 0)
{
errormessage.Text = "Enter an ID or Password.";
TextBoxID.Focus();
}
else if (ID.Length <= 4 || Password.Length <= 4)
{
errormessage.Text = "Invalid ID Or Password.";
TextBoxID.Focus();
}
else
{
try
{
using (var db = new Models.ModelContext())
{
var query = from p in db.LoginModel
where p.Student_Enrolletman == ID
&& p.Student_Password == Password
select p;
if (query.Any())
{
return true;
}
else
{
return false;
}
db.SaveChanges();
}