Very basic but not sure how to do since i am new to mvc.
I have to return a view based on a if condition.
if true, i should return a view with a guid value as querystring parameter else return a different view.
public ActionResult Act(Guid approvalCode)
{
bool result = businessProvider.CheckLinkValidity(approvalCode);
if (result == true)
{
return View("Act"); //here i need to pass approvalcode as querystring param
//want to do like
//return View("Act"+"?code="+approvalcode)
}
return View("LinkExpiredView");
}
I need to render the view like:
~\ResetController\Act?code= someguidvalue
I actually don't understand why you need query string.
Without it you can do like this:
return View("Act", new { code = "your-guid" });
If you still need it one of possible ways RedirectToAction
method:
return RedirectToAction("Act", new { code = "your-guid" });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With