In this method below I am working out a products code(StockItem):
var qisg = new QuoteItemSectionGroup
{
SectionGroup = db.SectionGroups.Where(x => x.Name == "Longitudinals" && x.Section == TruckSection.Floor).First(),
StockItem = quoteItem.BodyType.Longitudinal, <<--------
Quantity = 2,
Length = globals.FloorCalculatedLength
};
I have two classes called: BodyType & Chassis. Both has a column called Longitudinal.
In my method above I have worked out the BodyType.Longitudinal and = it to my StockItem.
StockItem = quoteItem.BodyType.Longitudinal,
The problem is that I have to set the second class Chassis.Longitudinal = to my StockItem aswell at the same time.
StockItem = quoteItem.Chassis.Longitudinal,
Example:
StockItem = quoteItem.BodyType.Longitudinal + quoteItem.Chassis.Longitudinal,
Is there a way to do this? I am just showing the example, because I have no idea how to do this.
EDIT: This is where I set the code for each StockItem
BodyType
context.BodyTypes.AddOrUpdate<BodyType>(x => x.Name,
new BodyType { Name = "Corrugated", isFlatDeck = false, LongitudinalId = context.StockItems.Where(x => x.StockCode == "SCH105").First().Id });
Chassis
context.Chassis.AddOrUpdate<Chassis>(x => x.Name,
new Chassis { Name = "DAIHATSU DELTA V116", LongitudinalId = context.StockItems.Where(x => x.StockCode == "SCH100").First().Id });
As far as I understand what you are trying to achieve, can't be done without changing the
QuoteItemSectionGroup
class.You should modify the
StockItem
into something like may be dictionary.And then fill data somewhat like this.