public ManufacturerGetById ( int id ) : |
||
id | int | |
리턴 |
public ActionResult AddVehicle(int?id) { // Attempt to get the associated object var a = m.ManufacturerGetById(id.GetValueOrDefault()); if (a == null) { return(HttpNotFound()); } else { // Attention - Add vehicle for a known manufacturer // We send the manufacturer identifier to the form // There, it is hidden... <input type=hidden // We also pass on the name, so that the browser user // knows which manufacturer they're working with // Create and configure a form object var o = new VehicleAddForm(); o.ManufacturerId = a.Id; o.ManufacturerName = a.Name; return(View(o)); } }