1
Answer

How the below code works

Ramco Ramco

Ramco Ramco

Aug 19
210
1

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)