public IQueryable<Customer> SimilarCustomersPOST(Customer customer)
 {
     var list = new List<Customer> { customer };
     return list.AsQueryable();
 }
 private Customer BuildCustomer(SqlDataReader reader)
 {
     Customer customer = new Customer();
     customer.CustomerID = reader.GetGuid(0);
     customer.CustomerID_OLD = GetString(reader, 1);
     customer.CompanyName = GetString(reader, 2);
     customer.ContactName = GetString(reader, 3);
     customer.ContactTitle = GetString(reader, 4);
     customer.Address = GetString(reader, 5);
     customer.City = GetString(reader, 6);
     customer.Region = GetString(reader, 7);
     customer.PostalCode = GetString(reader, 8);
     customer.Country = GetString(reader, 9);
     customer.Phone = GetString(reader, 10);
     customer.Fax = GetString(reader, 11);
     customer.RowVersion = reader.IsDBNull(12) ? (int?) null : reader.GetInt32(12);
     return customer;
 }
        public int Delete(SqlConnection conn, Customer customer)
        {
            using (SqlCommand command = new SqlCommand(DELETE, conn))
            {
                var p = command.Parameters;
                p.Add(new SqlParameter("@CustomerID", customer.CustomerID));

                var rowsAffected = command.ExecuteNonQuery();
                return rowsAffected;
            }
        }
 public int Update(SqlConnection conn, Customer customer)
 {
     return InsertOrUpdate(conn, customer, UPDATE);
 }
 public int Insert(SqlConnection conn, Customer customer)
 {
     return InsertOrUpdate(conn, customer, INSERT);
 }
        private int InsertOrUpdate(SqlConnection conn, Customer customer, string commandText)
        {
            using (SqlCommand command = new SqlCommand(commandText, conn))
            {
                var p = command.Parameters;
                p.Add(new SqlParameter("@CustomerID", customer.CustomerID));
                p.Add(new SqlParameter("@CustomerID_OLD", customer.CustomerID_OLD));
                p.Add(new SqlParameter("@CompanyName", customer.CompanyName));
                p.Add(new SqlParameter("@ContactName", customer.ContactName));
                p.Add(new SqlParameter("@ContactTitle", customer.ContactTitle));
                p.Add(new SqlParameter("@Address", customer.Address));
                p.Add(new SqlParameter("@City", customer.City));
                p.Add(new SqlParameter("@Region", customer.Region));
                p.Add(new SqlParameter("@PostalCode", customer.PostalCode));
                p.Add(new SqlParameter("@Country", customer.Country));
                p.Add(new SqlParameter("@Phone", customer.Phone));
                p.Add(new SqlParameter("@Fax", customer.Fax));
                p.Add(new SqlParameter("@RowVersion", customer.RowVersion));

                var rowsAffected = command.ExecuteNonQuery();
                return rowsAffected;
            }
        }