public ActionResult Login(Account objUser) { if (ModelState.IsValid) { using (SaphiraDB db = new SaphiraDB()) { var obj = db.Accounts.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault(); if (obj != null) { Session["UserID"] = obj.ID.ToString(); Session["UserName"] = obj.UserName.ToString(); return(RedirectToAction("UserDashBoard")); } } } return(View(objUser)); }
public ActionResult Login() { SaphiraDB db = new SaphiraDB(); return(View(db.Accounts)); }