// [ValidateAntiForgeryToken] public ActionResult Login(LoginViewModel model) { String msg = ""; Int32 AdminID = 0; DataTable dt; DataRow dr = null; if (ModelState.IsValid) { String Email = model.Email.Trim(); dt = userregistrationData.ValidateEmailAndGetAdminUserinfo(Email); if (dt != null && dt.Rows.Count > 0) { dr = dt.Rows[0]; AdminID = Convert.ToInt32(dr["MppAdminID"]); msg = userregistrationData.CheckAdminUserLogin(AdminID, model.Password); if (msg == "") { Session["AdminUserID"] = AdminID; Session["AdminFName"] = Convert.ToString(dr["FirstName"]); Session["AdminLName"] = Convert.ToString(dr["LastName"]); Session["UserType"] = dr["UserType"] is DBNull ? 1 : Convert.ToInt32(dr["UserType"]); var type = dr["UserType"] is DBNull?1:Convert.ToInt32(dr["UserType"]); if (type == 1) { return(RedirectToAction("Dashboard", "Seller", new { area = "Admin" })); } else { return(RedirectToAction("Dashboard", "Affiliation", new { area = "Admin" })); } } } else { msg = "Invalid login attempt!"; } TempData["IsValid"] = msg; return(RedirectToAction("Login", "Account", new { area = "Admin" })); } return(View(model)); }