Chapter 9: Creating Web Applications with ASP.NET MVC 279

Updating Existing Customers
Similar to how we created Customers, you also need two methods for editing a Customer.
The get method populates an edit form with existing data, and the post method saves the
changes. Listing 9-11 shows these two methods.
Listing 9-11 Methods for editing Customers
C#:
//
// GET: /Customer/Edit/5
public ActionResult Edit(int id)
{
Customer cust =
new CustomerRepository()
.GetCustomer(id);
Figure 9-8 The Create screen