Question Retrieving Data Based on Many-to-Many Relationship

zayn el

New member
Joined
Apr 29, 2023
Messages
1
Programming Experience
Beginner
I have a question like this but i can't do it

In the product category module of an E-Commerce system;

- "n" categories can be created under a category.
- A category can be under more than one category at the same time.

Write the code block that returns the list of categories under any category, according to the explanation above

I need to do it with c# ,i tried many times but it only shows subcategories of main categories

I want to check if subcategories have subcategories. How can I do it?
 
It's not for us to write your code for you. If what you tried didn't work then you did it wrong. If you don't show us what you did, we can't see what's wrong with it so we can't help you fix it. Show us your best attempt, explain the logic you're trying to implement, explain what happens and how that differs from your expectations. Then we can see whether there's a problem with your logic or your implementation or whatever.
 
I have moved this thread to a more suitable forum - it wasn't really about .NET Core - and I have also edited the title to something that actually gives some indication of the topic of the thread.
 
want to check if subcategories have subcategories. How can I do it?

Same way you do the first one. Probably it's a test of recursion. Write a method that gets all categories under category X. Call it one time with your root id X, and say you get 10 children, then call it 10 times (one for each child) passing the id of the child in so that it finds the children of the child . Then call it on all the child children. Etc
 
I have a question like this but i can't do it

In the product category module of an E-Commerce system;

- "n" categories can be created under a category.
- A category can be under more than one category at the same time.

Write the code block that returns the list of categories under any category, according to the explanation above

I need to do it with c# ,i tried many times but it only shows subcategories of main categories

I want to check if subcategories have subcategories. How can I do gta 5 download for android offline?

To retrieve all the subcategories under a category, including the subcategories of the subcategories, you can use a recursive function
 
Back
Top Bottom