views:

76

answers:

1

I have a view which displays data from the database like a blog post and at the bottom I would like the ability for a user to comment, how would one achieve this?

+1  A: 

By adding a form at the bottom of the view that will post to an action method. That action method will then process the form and save a comment against the blog post.

Garry Shutler
I get the following error: The model item passed into the dictionary is of type 'Blog.Web.Models.Post' but this dictionary requires a model item of type 'Blog.Web.Controllers.PostFormViewModel'.Any ideas, just starting out in MVC :)
Going to take a wild stab as I have no details and say you've defined your view as View<PostFormViewModel> and then called View(post) in your action. It should instead pass a PostFormViewModel object instead of just the Post.
Garry Shutler
You are correct, I will have a play and see what I can come up with and let you know.