I have a table named: Categories
2nd table named: Products
3rd Table named: ProductImages
A product details:
For example Nokia N70 Product Details:
Category --> Nokia
Product ---> N-70
Product Images Url --> image1.jpg, image2.jpg, image3.jpg
I want to insert a category named Nokia in categories table. I have done this well.
Now I want to insert a product in Products table, but here I am facing a problem, I can insert a single record having these attributes.
1. Product Name --> Nokia N70
2. Category Name --> Nokia
3. Price --> 1234
4. Screen Size --> A X B
5. ImageUrl --> abcd.jpg
6. ProductId -- > 1
But I want to insert multiple images, I want entity framework to create a table named ProductImages which will store multiple images against this product. I means I want to use ProductId as a foreign key in ProductImages table. All attributes of product should be saved in Product table but images urls should be saved in another table having named ProductImages
ProductImages with be two attribue, 1. ProductId (As a foriegn Key) 2. ImageUrl in this way.
Table: Products
1. Product Name --> Nokia N70
2. Category Name --> Nokia
3. Price --> 1234
4. Screen Size --> A X B
5. ProductId -- > 1
Table: ProductImages
1. Id (AutoGenerated) - 1
2. ProductId -- > 1
3. ImageUrl image1.jpg
1. Id (AutoGenerated) - 2
2. ProductId -- > 1
3. ImageUrl image2.jpg
1. Id (AutoGenerated) - 3
2. ProductId -- > 1
3. ImageUrl image3.jpg
If any one having idea, please inform me, I will be very thankful to you for this act of kindness.