Beispiel #1
0
        public string GetCustomerStreetAddressById(int id)
        {
            var customerStore = new CustomerStore();
            var customer = customerStore.GetById(id);

            return customer?.Address?.Street;
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        public async Task<Customer> GetCustomerByIdAsync(int id)
        {
            var customerStore = new CustomerStore();

            Customer customer = null;

            try
            {
                customer = await customerStore.GetByIdAsync(id);
            }
            catch (ArgumentException ex)
            {
                await Logger.LogAsync(ex.Message);
            }

            return customer;
        }
Beispiel #4
0
        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;
        }