public ActionResult NewPage(Page page) { if (ModelState.IsValid) { TratarPagina(page); _repository.SavePage(page); return RedirectToAction("Pages"); } return View(page); }
private static void TratarPagina(Page page) { if (!page.Path.StartsWith("/")) { page.Path = "/" + page.Path; } if (page.ShowInMenu) page.Visible = true; page.Path = page.Path.Trim().Replace(" ", "-"); page.Body = HttpUtility.HtmlDecode(page.Body); }