Exemplo n.º 1
0
        public IActionResult Create(Post post)
        {
            if (ModelState.IsValid)
                return View(post);

            post.PostedDate = DateTime.Now;
            post.Author = User.Identity.Name;
            return View();
        }
Exemplo n.º 2
0
        public IActionResult Post(long id)
        {
            var post = new Post();

            post.Title = "My Blog Post";
            post.PostedDate = DateTime.Now;
            post.Author = "Martin Benes";
            post.Body = "This is my first post";

            return View(post);
        }