I am trying to learn what options I have available regarding extending an existing bit of functionality that calls into a Handler.Execute() method and returns a view that displays a table of data. The extension to this functionality is to use that same data to return a view that triggers an excel download, I think via some HTTP Headers, but don't quote me on that.I have this Execute method on my handler:--public ViewModel Execute( GetInputModel inputModel ){// This if is newly added by meif (inputModel.WhichSubmitWasClicked != null && inputModel.WhichSubmitWasClicked.Equals("Bar")){}var data = finder.GetById<Data>( inputModel.Id );return new ViewModel( data.Values ) );}And I have a html form with a submit like so:<form action="..." method="GET">Other form fields here....
<input type="submit" name="WhichInputWasClicked" value="Foo" /><!-- The input below is newly added by me and the names are new as are the values --><input type="submit" name="WhichInputWasClicked" value="Bar" /></form>
What I was hoping to do was to allow the existing functionality to remain the same, so if the page loads then there would be no value regarding which button was clicked, so it would pass over the 'if' and do what was always happening. When the criteria for the 'if' has been met I wanted to trigger a different result, in my situation the original route displayed the same web page but with data that had been retrieved from a deliberate submission of the form on the page (as I have already said in my opening sentences). The conditional part would allow me to redirect to a different view that would in fact trigger a download of the data in Excel format.My problem is that the return type of the Excute() is ViewModel, but if I want to trigger a download from a different view, the types would be different and that obviously is not going to work. I could change the return type to a FubuContinuation and figure out how to make that redirect to the variant of my view that triggers a download, although I am not quite sure how to do that. I could as another alternative put the html form back to its original form with only 1 submit button, wait for the user to submit the form and then hide the foo button and show the bar button which would submit a different form with the same set of data that would trigger the download. Both I am sure have drawbacks, I can see from the second option that it would be very, very nasty, so I am actually trying to avoid doing that.What are my options here, FubuContinuation approach seems most reasonable, but I really am not an expert at FubuMvc to make the most enlightened of decisions or maybe there are other things I have not considered?
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fubumvc-deve...@googlegroups.com.
To post to this group, send email to fubumv...@googlegroups.com.
Visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks Josh. @Mark Let me know if you have any questions or problems.