I have a search function that takes search parameters. I have search results in the same result, and I want to redirect to a show action, and if there are many results then I want to direct the list action with all the results listed.
I got a redirect to work, but not quite well. I do not know how to transfer the search results, should the first "search" action be taken out of the ID only, and then it depends on show or list action to extract more data based on IDE? How should my ID be transferred in concrete action?
I probably have to submit a view to a search result with search results, if there are many results The list can reuse the view, if appropriate, but instead of attempting to redirect any other action with multiple ID it will be easy to display in case of the same result, for that action, Redirect may be appropriate Is obtained. This would mean that I would need to get enough data to populate the model for the list during the search. If a detailed action is redirected, then you only redirect from the ID and get the information necessary for your display.
Public view search (string query) {... get results ... if (result.count () == 1) {return redirection action ("Details", new {ID = Results. First (). Id}); } See Return ("List", this.CreateListViewModel (Results)); } Where CreateListViewModel takes a set of search results and generates a visual model object for the list view.
Comments
Post a Comment