0

I have a Controller which has a Create method to handle HttpPost data from a form. The page containing the form is accessed by the URL

CallOutcome/Call?orderId=114565

When the form is submitted, I do a db insert & create a view model object which is returned to the view to display the form again. This works fine, however the URL has now changed to the name of my action method:

CallOutcome/Create

How can I make it show the original URL? The desired result would be like that it worked like a postback, i.e. reshowing the same page and URL.

This is my (simplified) action method, which returns a CallDetailsViewModel object to a view named 'Call':

[HttpPost]
 public ActionResult Create(GGAP_CallOutcome callOutcome)
{
    if (ModelState.IsValid)
    {
        callRepository.SaveCallOutcome(callOutcome);
        return View("Call", new CallDetailsViewModel{
            CustomerOrder = new CustomerOrder{},
            CallOutcome = new CallOutcome{},
            Task = new Task{}
         });
     }
 }
markpsmith
  • 4,860
  • 2
  • 33
  • 62

1 Answers1

0

not many responses! too close to christmas maybe?

For the record, I used RedirectToRoute:

return RedirectToRoute(new
{
   controller = "CallOutcome",
   action = "Call",
   orderId = Convert.ToInt32(callOutcome.OrderId)
});

Which does exactly what I wanted.

markpsmith
  • 4,860
  • 2
  • 33
  • 62