asp.net mvc - Strongly Typed Views Model on a RedirectToAction -
i have 2 action methods this
[httppost] public actionresult search(models.inputmodel input) { if (!issearchcriteriavalid(input)) return redirecttoaction("index"); tempdata[tempdatasearchinput] = input; return redirecttoaction("list"); } public actionresult list() { var input = tempdata[tempdatasearchinput] models.inputmodel; if (!issearchcriteriavalid(input)) return redirecttoaction("index"); var result = new list<mydto>(); automapper.mapper.map( _repository.getby(input), results); var model = new models.displaylistmodel { result = result }; return view("list", model); }
is there standard best practices way this?
erx_vb.next.coder correct. code in search action not needed. assume did this, because form posting /[controller]/search? can still use search.aspx view if , point form /[controller]/list below.
<% using (html.beginform("foo", "bar", formmethod.post, new { id = "myid" })) { %> <%} %> result in following html: <form action="/bar/foo" id="myid" method="post"></form>
Comments
Post a Comment