title: Return a FileStreamResult if successful or View if unsuccessful
body: <p>In MVC, is there a way to return a FileStreamResult if my query is successful, but if not, just return the View with an error in the ViewBag. Like so....</p>
  
  <pre><code>    public FileStreamResult Submit()
      {
          string retVal;
          try
          {
              DataSet ds = new DataSet();
  
              ds = getDS();
              if (ds.Tables.Count &gt; 0 &amp;&amp; ds.Tables[0].Rows.Count &gt; 0)
              {
                  ExcelXmlWorkbook book = ExcelXmlWorkbook.DataSetToWorkbook(ds);
                  string fileName = "results.xml";
                  book.Export(fileName, ExportFormat.Xml, 0);
                  FileInfo info = new FileInfo(fileName);
                  return File(info.OpenRead(), "application/x-msexcel");
              }
              else
              {
                  retVal = "No Data";
              }
  
          }
          catch (Exception ex)
          {
              retVal = ex.Message;
          }
  
          ViewBag.Result = retVal;
  
          return View("ViewName");
      }
  </code></pre>
  
  <p>I know this does not work, but basically, I want to open a results file if the data pull was successful... if it wasn't, I want to display the page, or redirect to a different page to show the user that the results failed. Any suggestions on a better way is also welcomed. Thanks!</p>