public string GetCustomerStreetAddressById(int id) { var customerStore = new CustomerStore(); var customer = customerStore.GetById(id); return customer?.Address?.Street; }
public Customer GetCustomerById(int id, bool throwException) { var customerStore = new CustomerStore(); Customer customer = null; try { customer = customerStore.GetById(id); } catch (ArgumentException) when(!throwException) { } return customer; }
public string GetCustomerStreetAddressById(int id) { var customerStore = new CustomerStore(); var customer = customerStore.GetById(id); string address; if (customer == null || customer.Address == null) { address = null; } else { address = customer.Address.Street; } return address; }