예제 #1
0
        public ActionResult DownLoadSelected(string type, int[] selectedItems)
        {
            if (type == null || selectedItems == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (selectedItems.Length == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (selectedItems.Length == 1)
            {
                return(DownloadData(type, selectedItems[0]));
            }

            var tmpAssets = assets.GetSelected(selectedItems);

            FileDataBase fileData = new FileDataHandler();
            var          downFile = new byte[0];

            if (type == "xml" && tmpAssets.Count() > 0)
            {
                downFile = fileData.GetXmlListFile(tmpAssets);
            }

            if (type == "txt" && tmpAssets.Count() > 0)
            {
                downFile = fileData.GetTXTListFile(tmpAssets);
            }

            var filename = type.ToUpper() + "DataList." + type;

            return(File(downFile, System.Net.Mime.MediaTypeNames.Application.Octet, filename));
        }