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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -