public ActionResult Create(Post newPost) { List<Post> posts = GetPosts(); posts.Add(newPost); HttpContext.Application["myPosts"] = posts; return RedirectToAction("ViewPost"); }
public ActionResult Create() { Post post = new Post(); post.PostDate = DateTime.Now; var thePosts = GetPosts(); post.ID = thePosts.Max(x=>x.ID) + 1; return View(post); }