Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 528.9k

How the below code works

Aug 19 2024 4:54 AM

Hi

 How the below code works and what it will return

LMSDBDataContext context = new LMSDBDataContext();
var Result = (from t in context.UserLogins
              where t.LoginCode == Convert.ToInt32(AuthenticatedUser().Item3)
              select t).SingleOrDefault();
if (Result != null)
{

    var Result2 = (from t in context.View_UserLogins
                   where t.LoginCode == Result.LoginCode
                   select t).SingleOrDefault();
    return Tuple.Create(Result.LoginID, Result.UserRole, Result2.Name, Result.LoginCode.ToString(), Convert.ToBoolean(Result2.Active));
}
else
{
    return Tuple.Create("0", "User", "", "0", false);
}

Thanks


Answers (1)