public string Get(string path) { using (SiteEntitites ctx = new SiteEntitites()) { return ctx.Sites.FirstOrDefault(s => s.Name == path).Text; } }
public ActionResult Page(string page) { using (SiteEntitites ctx = new SiteEntitites()) { ViewBag.Header = page; ViewBag.Information = ctx.Sites.First(s => s.Name == page).Text; return View(); } }
public bool Update(string path, string text) { using (SiteEntitites ctx = new SiteEntitites()) { Site subSite = ctx.Sites.First(s => s.Name ==path); if (subSite != null) { subSite.Text = text; } ctx.SaveChanges(); return true; } }