-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beginner Question #6141
Comments
Per the article |
Sorry, I don't see how that answer is relevant. That line from the article is in reference to querying without a search UI element. With the code in my original question there is no need to modify the URL. No big deal, I was more just curious than anything. |
You could use that query. You'd also need to use a POST to bookmark the query. WIthout UI, how would the user know to hack the URL for a search. |
I think there's a miscommunication. I may not have asked my question in the most clear way. The section "Adding Search by genre" comes after the section in which you add the search bar UI. So we can search for Movies by title by using the search bar. Now, we want to add the ability to search by genre. It was not immediately clear why adding an additional model to the project is necessary to search by genre when you can just include it in the Where statement. I apologize if this question / discussion is not appropriate for this forum. Thanks for your responses. |
@wcski no problem. I think the Razor Pages version does a better job of explaining it, and the code is simpler. The view model is build into Razor Pages, one of the advantages it has over MVC. BTW, why are you doing the MVC tutorial and not the Razor Pages version? |
@wcski Your search does an |
Ah. I didn't look close enough. I see now that the tutorial has you create a select list (so you can filter by Genre and Title, like you said.) I told you it was a beginner question! Thanks for your help. As for Razor vs MVC - I have already done the Razor pages tutorial. I am doing the MVC tutorial because the projects I will be working on at work are MVC and not Razor pages. |
Hello, and thanks for the documentation. I have a quick question about adding search by genre.
The following code allows you to search by title and genre and seems to be a much simpler approach.
`public async Task Index(string searchString)
{
var movies = _context.Movie.AsQueryable();
Is there a reason why I should do all of what the documentation describes, or was it just for practice' sake?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: