public IActionResult Get(int customerId)
        {
            var custId = CustomerId.Create(customerId);
            var cust   = _dao.GetById(custId);
            var dto    = DtoConverter.CustomerToDto(cust);

            return(Ok(dto));
        }
        public IActionResult GetWithErrorHandling(int customerId)
        {
            Log("GetWithErrorHandling {0}", customerId);

            // first create the customer id
            // it might be null, so handle that case
            var custId = CustomerId.Create(customerId);

            if (custId == null)
            {
                Log("CustomerId is not valid");
                return(BadRequest("CustomerId is not valid"));
            }

            try
            {
                // look up the customer in the database
                // it might be null, so handle that case
                var cust = _dao.GetById(custId);
                if (cust == null)
                {
                    Log("Customer not found");
                    return(NotFound());
                }

                // this should always succeed
                var dto = DtoConverter.CustomerToDto(cust);

                // return
                return(Ok(dto));
            }
            catch (Exception ex)
            {
                // handle database errors
                var errMsg = $"Exception: {ex.Message}";
                Log("Exception: {0}", ex.Message);
                return(new ContentResult {
                    Content = errMsg, StatusCode = 500
                });
            }
        }