예제 #1
0
        public IActionResult Get(string DBName, string login, string password, string sql)
        {
            DAOLayer bc = new DAOLayer(sql.Replace("%", " "), DBName, login, password);

            List <Object[]> data = bc.reed();

            byte[] fileContents = ExcelExport.Export(data);

            if (fileContents == null)
            {
                return(NotFound());
            }

            return(File(
                       fileContents: fileContents,
                       contentType: ExcelExport.ContentType,
                       fileDownloadName: ExcelExport.FileDownloadName
                       ));
        }
예제 #2
0
        // Post?DBName=IBA&login=root&password=1111&sql=SELECT*FROM%20books

        public IActionResult Post([FromBody] Data dataUser)
        //public IActionResult Post2([FromHeader]string DBName, [FromHeader]string login, [FromHeader]string password, [FromHeader]string sql)
        {
            DAOLayer bc = new DAOLayer(dataUser.SQL, dataUser.DBName, dataUser.Login, dataUser.Password);
            //DAOLayer bc = new DAOLayer(sql, DBName, login, password);

            List <Object[]> data = bc.reed();

            byte[] fileContents = ExcelExport.Export(data);

            if (fileContents == null)
            {
                return(NotFound());
            }

            return(File(
                       fileContents: fileContents,
                       contentType: ExcelExport.ContentType,
                       fileDownloadName: ExcelExport.FileDownloadName
                       ));
        }