DEV Community

Discussion on: ASP.NET Core Blog tutorial: using LiteDB

Collapse
 
zoltanhalasz profile image
Zoltan Halasz

Hi! Something seems to be missing from the Index view. Where does the Model take the values?
Do you have the Github Repo with full code?
PS: I like this tutorial!

Collapse
 
dayvster profile image
Dayvster 🌊

Hiya Zoltan

No it's all there

return View(blogRepo.Posts.Find(
            p => p.Public == true && 
            p.Created <= DateTime.Now && 
            p.Deleted == false)
        );

That right there is all that's required, below that point I explain what the query itself does.

as for the github repo, not yet but I'll most likely create one today as I write the 4th part.

Collapse
 
zoltanhalasz profile image
Zoltan Halasz

I am referring to the html view, not the controller, there's missing something, if I follow part 1,2 and 3. You just iterate through something in the view, but show me the whole file, maybe in the header, @model xyz... is missing? Waiting for the GitHub repo, take your time, I am just studying this, no urgency.

Thread Thread
 
dayvster profile image
Dayvster 🌊

That is odd, I'll gladly create the repo right now for you to look at.

There ya go:
github.com/arctekdev/AspNetBlog

Thread Thread
 
zoltanhalasz profile image
Zoltan Halasz

It works now, thanks!

Thread Thread
 
dayvster profile image
Dayvster 🌊

\o/ all right! What was the issue if I may ask?

Thread Thread
 
zoltanhalasz profile image
Zoltan Halasz

I was playing around with the controller, and I forgot to add a .ToList(), I did a bit different version than yours.

Thread Thread
 
dayvster profile image
Dayvster 🌊

Awesome, glad you're experimenting, it's the best way to learn imho