public async Task <FileResult> Export() { string url = _appSettings.ApiUrl + "/Air/GetAllThingFromTelit"; client.BaseAddress = new Uri(url); HttpResponseMessage responseMessage = await client.GetAsync(url); var responseData = new ResponseData <SerialNumberExport>(); if (responseMessage.IsSuccessStatusCode) { responseData = responseMessage.Content.ReadAsAsync <ResponseData <SerialNumberExport> >().Result; if (responseData != null && responseData.DataList != null && responseData.DataList.Count > 0) { var file = _helperService.ExportExcel(responseData.DataList); byte[] fileBytes = System.IO.File.ReadAllBytes(file.FullName); return(File(fileBytes, "application/x-msdownload", file.Name)); } } return(null); }