Professional Cross-Platform Mobile Development in C# by Goers Kenny Horgen Ben Hunter John Olson Scott & John Hunter & Ben Horgen & Kenny Goers

Professional Cross-Platform Mobile Development in C# by Goers Kenny Horgen Ben Hunter John Olson Scott & John Hunter & Ben Horgen & Kenny Goers

Author:Goers, Kenny, Horgen, Ben, Hunter, John, Olson, Scott & John Hunter & Ben Horgen & Kenny Goers
Language: eng
Format: epub
Publisher: John Wiley & Sons
Published: 2012-01-27T16:00:00+00:00


Retrieving Detail Objects

Now that you have created a lightweight customer list, you need a way to return the full details of a customer at the appropriate point in the application workflow. You need the ability to view, add, and edit customer detail information but leave order processing for a separate workflow path. As such, you can design the data method and endpoints accordingly.

The code in Listing 7.7 shows the GetCustomer() data method. The data is organized so that the first address in the Addresses collection is always the default address. You can take that address and set the PrimaryAddress property, if it is not already set, before returning the customer to the service.

Listing 7.7: The GetCustomer method

public static Customer GetCustomer(string customer) { Customer retval = GetCustomerList().Where(obj => obj.ID == customer).FirstOrDefault(); if (retval.Addresses.Count > 0 && retval.PrimaryAddress == null) { retval.PrimaryAddress = new Address() { ID = retval.Addresses[0].ID, Description = retval.Addresses[0].Description, Street1 = retval.Addresses[0].Street1, Street2 = retval.Addresses[0].Street2, City = retval.Addresses[0].City, State = retval.Addresses[0].State, Zip = retval.Addresses[0].Zip }; } return retval; }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.