コード例 #1
0
 public ActionResult Index()
 {
     var datacontext = new SiteDataDataContext();
     HomePageViewModel model = new HomePageViewModel();
     model.MostRecentBlogPost = datacontext.BlogPosts.OrderByDescending(post => post.Date).First();
     return View(model);
 }
コード例 #2
0
 //
 // GET: /WaiGuoAtHome/
 public ActionResult Index()
 {
     var blogContext = new SiteDataDataContext();
     List<BlogPost> blogPosts = blogContext.BlogPosts.Take(10).ToList();
     return View(blogPosts);
 }