public ActionResult ShowPage(string id) { DynamicHTMLPage dPage = new DynamicHTMLPage(); //using (var db = new EF_CONTEXT()) //{ // page = db.DynamicHTMLPages.ToList().FirstOrDefault(e=>e.PageName==id); // if (page==null) // { // return HttpNotFound(); // } // return View(page); //} var possiblePath = _Extentions.PagesRootPath() + "\\" + id + ".html"; if (!System.IO.File.Exists(possiblePath)) { return(HttpNotFound()); } var page = System.IO.File.ReadAllText(possiblePath); dPage.PageName = id; dPage.RawHTML = page; return(View(dPage)); }
public ActionResult Edit(string id, ChangeDynamicPageViewModel model) { DynamicHTMLPage page = new DynamicHTMLPage(); if (!Exists(id)) { return(HttpNotFound()); } page.PageName = id; WriteFile(id, model.HtmlBody); TempData["Message"] = "Değişiklikler kaydedildi!"; return(RedirectToAction("Edit", "Pages", new { id = id })); }
public ActionResult Edit(string id) { if (!Exists(id)) { return(HttpNotFound()); } Models.EF_MODELS.DynamicHTMLPage page = new DynamicHTMLPage(); page.RawHTML = ReadFile(id); page.PageName = id; return(View(page)); }