public IActionResult Index() { ViewData["Title"] = ""; LandingPageVM h = new LandingPageVM(db, _mapper, _env); return(View(h)); }
public ActionResult Index() { LandingPageVM h = new LandingPageVM(); h.Init(db, _mapper, _env); h.load(); return(View(h)); }
public ActionResult Index() { var posts = db.Posts.Where(b => b.Published).OrderByDescending(b => b.Created).Take(6).ToList(); var myLandingPageVM = new LandingPageVM { TopLeft = posts.FirstOrDefault(), TopMiddle = posts.Skip(1).FirstOrDefault(), TopRight = posts.Skip(2).FirstOrDefault(), BottomLeft = posts.Skip(3).FirstOrDefault(), BottomMiddle = posts.Skip(4).FirstOrDefault(), BottomRight = posts.LastOrDefault() }; return(View(myLandingPageVM)); }
public ActionResult Index(int?page) { var posts = db.Posts.Where(b => b.Published).OrderByDescending(b => b.Created).Take(6).ToList(); var myLandingPageVM = new LandingPageVM { PostOne = posts.FirstOrDefault(), PostTwo = posts.Skip(1).FirstOrDefault(), PostThree = posts.Skip(2).FirstOrDefault(), PostFour = posts.Skip(3).FirstOrDefault(), PostFive = posts.Skip(4).FirstOrDefault(), PostSix = posts.LastOrDefault() }; return(View(myLandingPageVM)); }