예제 #1
0
        public IActionResult DownloadTemplate()
        {
            try
            {
                byte[] csvInBytes;
                var    csv = _service.DownloadTemplate();

                string fileName = "Grade.csv";

                csvInBytes = csv.ToArray();

                var file = File(csvInBytes, ContentType, fileName);
                return(file);
            }
            catch (Exception ex)
            {
                var error = new
                {
                    statusCode = HttpStatusCode.InternalServerError,
                    error      = ex.Message
                };
                return(StatusCode((int)HttpStatusCode.InternalServerError, error));
            }
        }