public static Customer GetCustomerById()

in Source/Website/Data_Layer/CustomerData.cs [26:46]


        public static Customer GetCustomerById(int customerId)
        {
            var query = "SELECT TOP 1 * FROM CUSTOMERS WHERE CustomerId = @customerId";
            var param = new SqlParameter("@customerId", customerId);

            try
            {
                var result = DataAccessHandler.ExecuteSelect(query, new SqlParameter[] { param });

                if (result.Rows.Count > 0 && result.Rows[0] != null)
                {
                    return GetMappedCustomer(result.Rows[0]);
                }

                return null;
            }
            catch (Exception e)
            {
                throw e;
            }
        }