Reputation: 3945
MVC - instead of creating a VM and passing in the values and drawing the view. i want to redirect to a URL using the values as parameters....so
instead of:
var model = new AvailabilityStepOneOfBookingVM(bookingQuery,
ListOfBookings, chosenDate, foodPodId);
return View(model);
I want to load the URL:
http://localhost:40310/OrchardLocal/Food/FoodPodAvailability/
StepOneOfBooking/(value of foodPodId)/(value of chosenDate)
redirect to action? directly from here or create a view and redirect from there?
Upvotes: 4
Views: 4119
Reputation: 112
If you have configurated your routes, you can do like this:
return RedirectToAction("ActionName", "ControllerName", new { foodPodId = 1,chosenDate = "2013-09-11" });
Upvotes: 1
Reputation: 15387
Try this
string url = string.Format("/OrchardLocal/Food/FoodPodAvailability" +
"/StepOneOfBooking/{1}/{0}", chosenDate, foodPodId)
return RedirectToAction(url);
Upvotes: 1
Reputation: 152556
You can use Redirect
string url = string.Format("/OrchardLocal/Food/FoodPodAvailability" +
"/StepOneOfBooking/{1}/{0}", chosenDate, foodPodId)
return Redirect(url);
Upvotes: 5