The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HomeController.cs 807B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Teknik.Areas.Blog.Models;
  7. using Teknik.Controllers;
  8. using Teknik.Models;
  9. namespace Teknik.Areas.Home.Controllers
  10. {
  11. public class HomeController : DefaultController
  12. {
  13. // GET: Home/Home
  14. private TeknikEntities db = new TeknikEntities();
  15. [AllowAnonymous]
  16. public ActionResult Index()
  17. {
  18. List<Post> lastPosts = new List<Post>();
  19. var found = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published).Take(10);
  20. if (found != null)
  21. lastPosts = found.ToList();
  22. ViewBag.Title = Config.Title;
  23. return View(lastPosts);
  24. }
  25. }
  26. }