Skip to content

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

@ixlin

Description

@ixlin

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions