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

            return customer?.Address?.Street;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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;
        }