public ActionResult UpdateProfile() { var userName = User.Identity.GetUserName(); string userType = new DB().ReadData("Select UserType From AspNetUsers where Email = '" + userName + "'"); string userID = User.Identity.GetUserId(); if (userType == "Landlord") { string iDforLand = new DB().ReadData("Select IDforLand From Landlords where ApplicationUserId = '" + userID + "'"); return(RedirectToAction("Edit", "Landlords", new { id = AppHandler.Encrypt(iDforLand) })); } if (userType == "Tenant") { string tenantID = new DB().ReadData("Select TenantID From Tenants where ApplicationUserId = '" + userID + "'"); return(RedirectToAction("Edit", "Tenants", new { id = AppHandler.Encrypt(tenantID) })); } return(View()); }