public ActionResult ChangeChapter(StaticChapter chap) { using (zcrlDbContext = new ZcrlContext()) { var historyChapter = (from c in zcrlDbContext.Chapters where (c.Id == chap.Id) select c).First(); if (historyChapter == null) { return(RedirectToAction("NotFound", "Error")); } historyChapter.Content = chap.Content; zcrlDbContext.SaveChanges(); switch (chap.ChapterType) { case StaticChapterType.History: { return(RedirectToAction("History", "Home")); } case StaticChapterType.PortalInformation: { return(RedirectToAction("Information", "Home")); } default: { return(RedirectToAction("News", "Home")); } } } }
// private Dictionary<int, int> dict = new Dictionary<int, int>(); public static StaticChapter Instance() { if(_instance == null) { lock(lockHelper) { if(_instance == null) { _instance = new StaticChapter(); _instance.readData(); } } } return _instance; }