I have few questions based on following scenario:
I have a LoginController with following methods:
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(UserObject user)
{
Calling Besiness Service to Validate User againts DB (Using Repository)...
if (success)
{
return RedirectToAction("Search", "Search");
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
return View(user);
}
After successful login, I have to present a Search screen. I have a SearchController with following methods:
public ActionResult Search()
{
return View(); // This returns a EMPTY Search Form.
}
[HttpPost]
public ActionResult Search(SearchView search)
{
// Validate Search parameters...
// I have to perform a search by calling Business Service and present results. I would like to use a seperate controller (PricingController) for this task.
return RedirectToAction("Index", "Pricing"); // Not sure if this is the correct way?
}
Now I would like to have a PricingController which will take "SearchView" ViewModel containing my search parameters and call a Business Service to get the pricing results and present it to the user.
Is this a correct approach? How do I pass the "SearchView" ViewModel containing my search parameters to PricingController from SearchController? I need access (data) to "SearchView" ViewModel throughout the application because user can add optional items based on initial search criteria and can modify this search criteria if required. Should I store "SearchView" ViewModel in Cache? I will be deploying my application in Web Farm and don't want to use Http Session. I will be using Cookies for managing user sessions.