Is it possible to return FileContentResult AND PartialView from the same controller? I can't make it working. Main controller code:
...
var generateClass = new GenerateExcel(); // create obj of another class
generateClass.Generate(reports); // generate .xlsx file and save it to server disk
Download(); // ??? download file to client PC via "Save as.." dialog
return PartialView("_PartialReport", reports); // second (main) return and the end of controller
Download() method here:
public FileContentResult Download()
{
    using (HostingEnvironment.Impersonate())
    {
         byte[] doc = System.IO.File.ReadAllBytes(@"C:\temp\BLP.xlsx");
         // doc is OK, it's size == size of .xlsx file
         return File(doc, "application/vnd.ms-excel");
    }
}
No errors but not work.. Help someone please?
Update: ajax code example
// Generate report by creation date
function ConstructReportByDate() {
    var date1 = $('#DateFrom').val();
    var date2 = $('#DateTo').val();
    $.ajax({
        url: '/Reports/ConstructReport',
        type: "POST",
        contentType: 'application/json; charset=utf-8',
        cache: false,
        data: '{"kind":"byDate", "date1":"' + date1 + '", "date2":"' + date2 + '"}'
    })
    .done(function (data) {
        $('#Report').html(data);
    })
    .fail(function (xhr) {
        alert('errorHere');
    });
}
 
     
    