我的膳食课堂(服务器端)
公共课餐{
public Meal()
{
Fruits = new List<Fruit>();
}
public int Id { get; set; }
public string Name { get; set; }
[ForeignKey("Fk_VendorId")]
public virtual Vendor Vendor { get; set; }
public int Fk_VendorId { get; set; }
//collection
public virtual ICollection<Fruit> Fruits { get; set; }
}
表单HTML:
<div ng-controller="MealCtrl>
<select ng-model="meal.Id" ng-options="meal.Id as meal.Name for meal in Meals"></select>
</div>
<div ng-controller="FruitCtrl>
<select ng-model="???" ng-options="fruit.Id as fruit.Name for fruit in fruits"></select>
</div>
<div ng-controller="VendorCtrl>
<select ng-model="???" ng-options="vendor.Id as vendor.Name for vendor in vendors"></select>
</div>
问题:
如何在提交时将选定的关联类 [Vendor] 和关联的集合 [Fruits] 传递给 Meal 类?