In one of my Controllers i have this "Edit" Action Method where registered user can edit his personal information (Name, Phone Number etc.), this Action Method can be called from two different places (from two different Controllers and two different Action Methods) on my website, i want to implement following:
-if "Edit" Action Method is called from "place A", then after this Action Method is completed redirect user to "View A"
-if "Edit" Action Method is called from "place B", then after this Action Method is completed redirect user to "View B"
I don't have any idea how to do this, so please help.
You can use place name as action parameter
public ActionResult Edit(User user, string viewName)
{
**Your code**
..
..
..
if(viewName == "place A") return View("View A");
else if(viewName == "place b") return View("View b");
}
or use switch case
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.