在ASP.NET MVC的当前示例中,我看到了非常基本的实体,使用简单的CRUD方法.
但我不确定如何处理更高级的模型.让我举个例子:
我们有一个车库网站.车库有:
carpartsEmployeesCustomersCars 这包括车库里的所有车辆现在让我们来看看car,汽车可能有一个在汽车employees上工作的集合(从原始employee类派生,添加一些额外的道具将他绑在汽车上),一组carparts已被替换(也派生,例如添加) SerialNr和ReplacementDateprop),当然customer也是拥有汽车的客户的支柱.
现在rest我希望看到以下内容:
/cars/423 [get] //show car # 423
/cars/423/edit [get] //shows the edit form (ajax enabled, so also shows the other props)
/cars/423/carparts [get] //gets the carparts inside the car
/cars/423/carparts/32/edit [post] //updates that specific carpart inside the specific car
/cars/423/employees [get] //gets the employees who worked on the car
/inventory [get]
/inventory/1234/edit [get] //gets …Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×1