TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venalyn Sudaria
NA
98
598
How to joint the data of 'MECH' to 'TECH' data?
Apr 25 2019 10:17 PM
I am trying to join the data of "MECHANICAL" to "TECHNICAL" but I don't know how to do it.
This is my current code that list all the Data under DecodedFactoryOptions: At first, I groupby every equipments by their Categories..
Here is my code:
public
static
IEnumerable<VehicleFactoryOptionModel> GetFactoryOptions(IEnumerable<DecodedFactoryOption> options)
{
var optionEquipment =
new
List<VehicleFactoryOptionModel>();
if
(options ==
null
)
return
optionEquipment;
var optEquip = options.GroupBy(e => e.Category);
foreach
(var equip
in
optEquip) {
var optionalEquipment =
new
VehicleFactoryOptionModel { Data =
new
List<VehicleCategoryOptionModel>()};
if
(equip !=
null
) {
foreach
(var eq
in
equip)
{
optionalEquipment.TypeId = eq.OptionHeaderId;
optionalEquipment.Description = eq.Description;
optionalEquipment.Data.Select(d => d.StyleIds == eq.AppliedStyleId);
optionalEquipment.chromeCode = eq.chromeCode;
optionalEquipment.oemCode = eq.oemCode;
optionalEquipment.optionKindId = eq.optionKindId;
if
(eq.OptionCategoryId ==
null
)
continue
;
FillOptionCategoryInfo(eq, optionalEquipment); } }
optionEquipment.Add(optionalEquipment); }
return
optionEquipment; }
The result of the above code is this:
[
{
"TypeId": 1236,
"TypeName": "MECHANICAL",
"Data":
[ { "Description": "Engine: 5.7L V8 DOHC 32V FFV w/i-Force",
"Categories":
[ { "Id": 1052, "Name": "Engine-8 Cyl" } ],
"StyleIds": [ 362074, 362107 ] },
{ "Description": "Engine: 5.7L V8 DOHC 32V FFV w/i-Force",
"Categories": [ { "Id": 1213, "Name": "Fuel System-Flex Fuel" } ],
"StyleIds": [ 362074, 362107 ] } },
{ "TypeId": 1176,
"TypeName": "TECHNICAL",
"Data":
[ {
"Description": "Tires: P275/55R20 Bridgestone/Dunlop Performance",
"Categories":
[ { "Id": 1092, "Name": "Tire-Front-Performance" } ],
"StyleIds": [ 362074, 362107 ] },
{ "Description": "Tires: P275/55R20 Bridgestone/Dunlop Performance",
"Categories": [ { "Id": 1097, "Name": "Tire-Rear-Performance" } ],
"StyleIds": [ 362074, 362107 ] },
{
"TypeId": 10689,
"TypeName": "ENTERTAINMENT",
"Data":
[ {
"Description": "Radio: Entune Premium w/JBL Audio & Navigation -inc: AM/FM/HD radio, CD player MP3/WMA playback capability, high-resolution 7\" touch-screen display, auxiliary audio jack, USB 2.0 port, iPod connectivity and control, iTunes Tagging, traffic and weather, JBL speakers and amplifier, Bluetooth hands-free phone capability, phone book access, voice recognition and music streaming, Entune App Suite includes Bing, iHeartRadio, MovieTickets.com, OpenTable, Pandora, Yelp and Facebook Places; real-time info including traffic, weather, fuel prices, sports and stocks, SIRIUSXM Satellite Radio, 90-day free trial", "Categories": [ { "Id": 1014, "Name": "Audio-AM/FM Stereo" } ],
"StyleIds": [ 362074, 362107 ] },
{ "Description": "Radio: Entune Premium w/JBL Audio & Navigation -inc: AM/FM/HD radio, CD player MP3/WMA playback capability, high-resolution 7\" touch-screen display, auxiliary audio jack, USB 2.0 port, iPod connectivity and control, iTunes Tagging, traffic and weather, JBL speakers and amplifier, Bluetooth hands-free phone capability, phone book access, voice recognition and music streaming, Entune App Suite includes Bing, iHeartRadio, MovieTickets.com, OpenTable, Pandora, Yelp and Facebook Places; real-time info including traffic, weather, fuel prices, sports and stocks, SIRIUSXM Satellite Radio, 90-day free trial",
"Categories": [ { "Id": 1017, "Name": "Audio-CD Player" } ],
"StyleIds": [ 362074, 362107 ] },
I wanted the "MECHANICAL"'s data will be join into the "TECHNICAL" data. and the TypeName and TypeID of MECHANICAL will be removed but the DATA of it will be join/transfered to the TECHNICAL DATA
Reply
Answers (
1
)
Change URL according t language
summary page filter option