Home > Net >  For help! C # system. Data. Enriry did not contain definitions of xx
For help! C # system. Data. Enriry did not contain definitions of xx

Time:10-07

Background debug cough up value for the first time, after there has been so, update model, to add a database, are tried, I just started, hope who can help me solve, thank you very much!

CodePudding user response:

Viewbag. Order this step, what do you look at the data sources have been the first, add a firstordefault behind the where is the object of tolist collection,

CodePudding user response:

The order does not exist, check, you ViewTag properties,

CodePudding user response:

Your Orders. Where the returned is not a single object,

CodePudding user response:

Upstairs positive solution, change the where clause to under FirstOrDefault is a single object, where the returned is set

CodePudding user response:

Upstairs is
@ viewBag. Order [0]. OrderNumber

CodePudding user response:

Incredibly don't return to the view of the model, and use ViewBag directly, why want to?

Have you ever seen your what kind of the return value is the Where?
  •  Tags:  
  • C#
  • Related