예제 #1
0
        public IActionResult Index()
        {
            BlogRepo blogRepo = new BlogRepo();

            blogRepo.CreateExamplePosts();
            return(View(blogRepo.Posts.Find(
                            p => p.Public == true &&
                            p.Created <= DateTime.Now &&
                            p.Deleted == false)
                        ));
        }
        public IActionResult Index([FromRoute] string postTitle)
        {
            BlogRepo blogRepo = new BlogRepo();

            blogRepo.CreateExamplePosts();

            return(View(
                       blogRepo.Posts.Find(
                           p => p.Title == postTitle.Replace("-", " ")
                           ).FirstOrDefault()
                       ));
        }