I want to retrieve whole row of data from database when a specific user log in. and show it in my view of profile.
this is my Controller already assigned it a Session variable on ID, I now want to retrieve data from database through this U_ID.
- public ActionResult Index(Account_Details log)
- {
-
- var obj = db.Account_Details.Where(u => u.Name.Equals(log.Name) && u.Password.Equals(log.Password)).FirstOrDefault();
-
- if (obj != null)
- {
-
- Session["loginid"] = obj.U_ID;
- Session["name"] = obj.Name;
- return RedirectToAction("Welcome");
- }
-
- else
- {
- return View();
- }
- }
this is my Model where I've assigned a foreign key to Basic_Detail table in database. So, that I can get Basic_Detail row of data through U_ID