I have two submit button in a form , one to search records corresponding a name , second one is to update that record in DB after doing correction if required.
Three action in controller
- Edit with
HttpGet
-- when first time view display it load all the name from DB to a dropdownlist - Edit with
HttpPost
-- When we click search it fetch every detail of that name - EditPerson
HttpPost
-- When we click Edit record It save All the Data Back to DB
In code I wanna do this
public ActionResult EditOperation(string Command, DataLayer objmodel)
{
if (Command == "Search")
{
return RedirectToAction(Edit with Post method) // How to ? always going to Edit With get method
}
else if (Command == "Edit Record")
{
return RedirectToAction(EditPerson) //Easy to redirect but How to send Model object also ?
}
return View("Edit",objmodel);
}
RedirectToAction (String ActionName, String ControllerName , Object routeValues)
Is There any way to tell the complier that redirect to Edit Action but the one who have Post method not the Get ?
Note : Dont wanna use Javascript here , only pure c# code