// READ: Customer/Edit/5 public ActionResult Edit(int id) { // pull in all customers into a CustomerModel list (based on data access model) var data = CustomerProcessor.LoadMultiMap(id); // create a new list of CustomerModel type (based on the UI model) CustomerViewModel customerEdit; customerEdit = new CustomerViewModel { CustomerID = data.CustomerID, FirstName = data.FirstName, LastName = data.LastName, Address = data.Address, City = data.City, Province = data.Province, PostalCode = data.PostalCode, PhoneNumber = data.PhoneNumber, Email = data.Email, LeadSource = data.LeadSource, Status = data.Status, Notes = data.Notes, FinancialID = data.FinancialData.FinancialID, Quote = data.FinancialData.Quote, FinalPrice = data.FinancialData.FinalPrice, Commission = data.FinancialData.Commission }; return(View(customerEdit)); }
// READ: get details for a customer public ActionResult Details(int id) // the int ID is coming from the path of the controller { // pull in one customer into a CustomerModel object (based on data access model) var data = CustomerProcessor.LoadMultiMap(id); // create a new object of CustomerModel type (based on the UI model) CustomerViewModel customerDetails; customerDetails = new CustomerViewModel { CustomerID = data.CustomerID, FirstName = data.FirstName, LastName = data.LastName, Address = data.Address, City = data.City, Province = data.Province, PostalCode = data.PostalCode, PhoneNumber = data.PhoneNumber, Email = data.Email, LeadSource = data.LeadSource, Status = data.Status, Notes = data.Notes, FinancialID = data.FinancialData.FinancialID, Quote = data.FinancialData.Quote, FinalPrice = data.FinancialData.FinalPrice, Commission = data.FinancialData.Commission }; return(View(customerDetails)); }