Пример #1
0
        public async Task <IActionResult> GetP206DataByArticle(SExcelHome sExcelHome)
        {
            _logger.LogInformation(String.Format(@"****** ExcelController GetP206DataByArticle fired!! ******"));

            List <SqlParameter> pc = new List <SqlParameter> {
                new SqlParameter("@Article", sExcelHome.article)
            };
            var data = await _context.GetP206DataByArticle
                       .FromSqlRaw(" EXECUTE dbo.GetP206DataByArticle @Article ", pc.ToArray())
                       .ToListAsync();

            string title = "";

            if (data.Count > 0)
            {
                title = data[0].Title;
            }
            else
            {
                return(Ok("0"));
            }

            byte[] result = _excelService.CommonExportReportWithATitle(data, "TempP206DataByArticle.xlsx", title);
            return(File(result, "application/xlsx", "P206DataByArticle.xlsx"));
        }