/// <summary> /// 触发页面切换事件 /// </summary> public void OnPageSwitchEvent(ContentPages switchToPage) { if (null != PageSwitchEvent) { PageSwitchEvent(switchToPage); } }
public ContentResult Sitemap() { SitemapLib.Sitemap sitemap = new SitemapLib.Sitemap(); string host = Request.Url.Scheme + "://" + Request.Url.Host; Random random = new Random(); //Add regular pages foreach (ContentPageBasicViewModel page in ContentPages.Pages()) { if (page.IncludeInSitemap) { sitemap.AddLocation(host + page.VirtualPath, DateTime.Today, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Monthly); } } //Add blog post pages TKS.Areas.Admin.Models.Blog.BlogPosts blogPosts = new TKS.Areas.Admin.Models.Blog.BlogPosts("en-US"); foreach (TKS.Areas.Admin.Models.Blog.BlogPostViewModel blogPost in blogPosts.EveryPost()) { sitemap.AddLocation(host + blogPost.URL, blogPost.PublishDate, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Yearly); } //Add News pages TKS.Areas.Admin.Models.CMS.NewsSet newsSet = new TKS.Areas.Admin.Models.CMS.NewsSet(); foreach (TKS.Areas.Admin.Models.CMS.NewsModel news in newsSet.News()) { sitemap.AddLocation(host + news.URL, news.DateReleased, "0." + random.Next(3, 9).ToString(), ChangeFrequency.Never); } Response.ContentType = "text/xml"; return(Content(sitemap.GenerateSitemapXML())); }
public async Task <ActionResult> DeleteConfirmed(int id) { ContentPages contentPages = await db.ContentPages.FindAsync(id); db.ContentPages.Remove(contentPages); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "Id,PageName,PageDescription,PageCode,Sort,CreatedDate,UpdatedDate,Description")] ContentPages contentPages) { if (ModelState.IsValid) { db.ContentPages.Add(contentPages); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(contentPages)); }
/// <summary> /// 窗体切换内容页 /// </summary> /// <param name="switchToPage"></param> private void MainWindow_PageSwitchEvent(ContentPages switchToPage) { switch (switchToPage) { case ContentPages.Achievement: if (null != achievement) { mainContent.Content = achievement; } else { mainContent.Content = new Achievement(); } break; case ContentPages.Chapters: if (null != chapters) { mainContent.Content = chapters; } else { mainContent.Content = new Chapters(); } break; case ContentPages.Questions: if (null != questions) { mainContent.Content = questions; } else { mainContent.Content = new Questions(); } break; case ContentPages.AnswerQuestion: if (null != questionEidtor) { mainContent.Content = questionEidtor; } else { mainContent.Content = new MathEidtor(); } break; default: break; } }
public async Task <ActionResult> Edit([Bind(Include = "Id,PageName,PageDescription,PageCode,CreatedDate")] ContentPages contentPages) { if (ModelState.IsValid) { contentPages.UpdatedDate = DateTime.Now; db.Entry(contentPages).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(contentPages)); }
// GET: ContentPages/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContentPages contentPages = await db.ContentPages.FindAsync(id); if (contentPages == null) { return(HttpNotFound()); } return(View(contentPages)); }
public ActionResult Create(ContentPageViewModel contentPage) { Guid PageID = ContentPages.Add(contentPage); return(Redirect("/admin/pages/edit/" + PageID.ToString() + "#tabs-4")); }
// GET: Admin/Pages public ActionResult Index() { List <ContentPageViewModel> pages = ContentPages.Pages(); return(View(pages)); }