次のようなビューモデルがある場合:
public class Car
{
Wheel CarWheel {get;set;}
Body CarBody {get;set;}
}
私の Wheel クラスと Body クラスは次のようになります。
public class Wheel
{
int Number {get;set;}
string WheelType {get;set;}
}
public class Body
{
int Number {get;set;}
string BodyType {get;set;}
}
そして、ホイール番号が 1 未満のモデル エラーを追加します。
ModelState.AddModelError(???, "Error! You must have at least one wheel to avoid abrasion on your bottom");
エラーが Body クラスではなく、特に Wheel クラスにあることを指定するにはどうすればよいですか?