Ejemplo n.º 1
0
        //http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-asp-net-mvc


        // I have file not found issue
        // here is a work around
        // https://github.com/aspnet/Mvc/issues/5053
        public IActionResult GetKindleFile(string url)
        {
            // check domain
            var firstPageUri = new Uri(url);

            if (firstPageUri.Scheme == "file")
            {
                var note       = new MyNote();
                var bookHelper = new BookHelper(note);
                var kindleFile = bookHelper.CreateKindleFiles(url, true);
            }
            else
            {
                // special for thuvienhoasen 1 tac gia
                if (firstPageUri.Host == "thuvienhoasen.org" && firstPageUri.Segments.Contains("author/"))
                {
                    var collection = new ThuVienHoaSenCollection();
                    collection.GetWholeCollection(url);
                }
                else
                {
                    GeneralSite setting = SettingFactory.Get(url);

                    if (setting != null)
                    {
                        var bookHelper = new BookHelper(setting);
                        var kindleFile = bookHelper.CreateKindleFiles(url);
                    }
                }
            }

            return(View("Index"));
        }