Can I retake a cc course in the same cc district?

I took a summer course recently and didn’t get my ideal grade. I haven’t transferred it to the university that I’m in full-time yet, but some of my friends have been telling me that I could technically take the course again at a different cc and transfer that grade instead. Is that allowed/legal?

If it is, would I be able to take it at a cc that’s within the same cc district as the c that I originally took the course at? For reference, I’m looking at cc’s in the Los Angeles CC District (LACCD).

Any advice is appreciated.