Click here to Skip to main content
15,947,613 members

Comments by dobravka (Top 4 by date)

dobravka 6-Dec-15 19:08pm View    
Check this :
There is only Id that matters, the rest is needed but actually ignored.
Here you can find explanation:
dobravka 6-Dec-15 18:47pm View    
So I think that approved answer in this post will solve your problem.
dobravka 6-Dec-15 17:15pm View    
First of all I assume you are using ASP.Net MVC, but you didn't tag it so I'm not even sure. Or I don't know if it is Razor engine or aspx?

When a user goes to Category View, the view is being displayed with Category model, so it has the Id there. You can access it in the View so there is no need to ask user.

And you don't have to display all form controls. Also it may be helpful to change the values you don't want user to fill to nullable. Than validation would pass even without the data.
dobravka 6-Dec-15 16:53pm View    
Is this DB access line working fine? I see you compare CategoryName with CategoryId.

If it is, it looks like you are missing one thing - a list of Posts in Category Model. There you should put Posts filtered for that Category and then display it in a View. After that you do the same thing as in my previous response - redirect user to each Post by PostId.

Remember that these are ViewModels not just Models, so it should be designed in the way it is the best for you to display it.