public ActionResult Index(DocumentRootModel model) { var root = model.ToDocumentRoot(); return View( _browser.ListDocumentNames(root) ); }
public ActionResult Index(DocumentRootModel rootModel, [Required] string term) { if (ModelState.IsValid == false) { return HttpNotFound(); } var root = rootModel.ToDocumentRoot(); var results = _searcher.Search(root, term); return View( new IndexModel(results, term) ); }
public ActionResult View(DocumentRootModel rootModel, string url) { // HACK: find a better way to resolve image urls to disk locations ... if (url.EndsWith(".png")) { var repo = Server.MapPath("~/App_Docs/"); return File(Path.Combine(repo, rootModel.Product + "/" + rootModel.Language + "/" + rootModel.Version + "/" + url), "image/png"); } var doc = _browser.GetDocument(rootModel.ToDocumentRoot(), url); if (doc == null) { return HttpNotFound(); } return View( new ViewModel(doc.Title, rootModel.Product, _formatter.ToHtml(doc, Url)) ); }