dotnet / dotnet/AspNetCore.Docs

movies = movies.Where(x => x.Genre problem

Open
#33,884 0 comments 0 reactions 1 assignee Claimed by @wadepickett View on GitHub
aspnet-core/svc Source - Docs.ms tutorials/subsvc
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

# Translation
When I followed the documentation and implemented the method of filtering movies based on the type selected in the drop-down box, I selected "ALL" and nothing was displayed. At this time, I realized a small problem in the code and modified the following code:
if(!String.IsNullOrEmpty(movieGenre) && movieGenre!= "ALL"){ movies = movies.Where(x => x.Genre == movieGenre); }
I hope the teacher can understand this problem. If you can give better suggestions, I would be very grateful.

### Description

当我根据文档教材,实现根据下拉框选择的类型筛选电影后,我选择了“ALL”,结果什么也没有显示,这时候我意识到代码中的一个小问题,然后修改了下面这段代码:
`if(!String.IsNullOrEmpty(movieGenre) && movieGenre!= "ALL"){
movies = movies.Where(x => x.Genre == movieGenre);
}`
希望老师能理解这个问题,如能给出更好的建议,那就太感谢了。
good luck

### Page URL

https://learn.microsoft.com/zh-cn/aspnet/core/tutorials/first-mvc-app/search?view=aspnetcore-8.0

### Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/first-mvc-app/search.md

### Document ID

5438de31-8562-3747-d1a5-2a4622252fc1

### Article author

@wadepickett

[Related Issues](https://github.com/dotnet/AspNetCore.Docs/issues?q=is%3Aissue+is%3Aopen+5438de31-8562-3747-d1a5-2a4622252fc1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.