// Manually map objects, source to target public IEnumerable <CustomerBase> CustomerGetAllManual() { // Define a new empty view model collection var results = new List <CustomerBase>(); // Fetch all the objects from the data store var allCustomers = ds.Customers; // Manually map each source object to a target object foreach (var customer in allCustomers) { // Create and configure a new target object var c = new CustomerBase(); c.Address = customer.Address; c.City = customer.City; c.Company = customer.Company; c.Country = customer.Country; c.CustomerId = customer.CustomerId; c.Email = customer.Email; c.Fax = customer.Fax; c.FirstName = customer.FirstName; c.LastName = customer.LastName; c.Phone = customer.Phone; c.PostalCode = customer.PostalCode; c.State = customer.State; // Add the new target object to the results collection results.Add(c); } // Return the results return(results); }
// Manually map objects, source to target public IEnumerable<CustomerBase> CustomerGetAllManual() { // Define a new empty view model collection var results = new List<CustomerBase>(); // Fetch all the objects from the data store var allCustomers = ds.Customers; // Manually map each source object to a target object foreach (var customer in allCustomers) { // Create and configure a new target object var c = new CustomerBase(); c.Address = customer.Address; c.City = customer.City; c.Company = customer.Company; c.Country = customer.Country; c.CustomerId = customer.CustomerId; c.Email = customer.Email; c.Fax = customer.Fax; c.FirstName = customer.FirstName; c.LastName = customer.LastName; c.Phone = customer.Phone; c.PostalCode = customer.PostalCode; c.State = customer.State; // Add the new target object to the results collection results.Add(c); } // Return the results return results; }