public ActionResult fanfic(int id, string type) { var bookRepository = new BookRepository(new QueryDocument("id",id)); ViewBag.Title = bookRepository.Books[0].title; ViewBag.Type = type; return View(bookRepository.Books); }
public ActionResult Index(int left = 0, int limit = 20) { //--Initialization--------------- string genre = Request["genre"]; string size = Request["size"]; string rating = Request["rating"]; string state = Request["state"]; string category = Request["category"]; bool blah = Convert.ToBoolean(Request["blah"]); string searchName = Request["searchName"]; QueryDocument query = new QueryDocument(); //------------------------------- if (category != null || state != null || genre != null || size != null || rating != null) { query = new QueryDocument { {"genre", genre }, {"size", size }, {"rating", rating }, {"state", state }, {"category", category } }; } if (searchName != null) { if(blah) { query = new QueryDocument("title",new BsonRegularExpression("/" + searchName + @"/\im")); } else { query = new QueryDocument("author", new BsonRegularExpression("/" + searchName + @"/\im")); } } var bookRepository = new BookRepository(query, left, limit); ViewBag.genre = genre; ViewBag.size = size; ViewBag.rating = rating; ViewBag.state = state; ViewBag.category = category; if (searchName != null) ViewBag.blah = blah; ViewBag.searchName = searchName; ViewBag.left = left; ViewBag.limit = limit; ViewBag.count = bookRepository.Count; return this.View(bookRepository.Books); //--Delete "this." }
public ActionResult download(int id) { var bookRepository = new BookRepository(new QueryDocument("id", id)); ProcessStartInfo process = new ProcessStartInfo(@"C:\Program Files\7-Zip\7z.exe", @"a -tzip " + bookRepository.Books[0].path.Replace("html","zip") + " " + bookRepository.Books[0].path); process.WindowStyle = ProcessWindowStyle.Hidden; process.CreateNoWindow = true; Process procCommand = Process.Start(process); while (procCommand.HasExited == false) { } FileStream fin = new FileStream(bookRepository.Books[0].path.Replace("html", "zip"), FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader cin = new StreamReader(fin, System.Text.Encoding.Default); string stringStream = cin.ReadToEnd(); cin.Close(); fin.Close(); System.IO.File.Delete(bookRepository.Books[0].path.Replace("html", "zip")); return File(new MemoryStream(System.Text.Encoding.Default.GetBytes(stringStream)), "application/zip",id.ToString()+".zip"); }
public ActionResult Index() { var bookRepository = new BookRepository(); return this.View(bookRepository.Books); //--Delete "this." }
public ActionResult FanFics() { var bookRepository = new BookRepository(); return this.View(); }