I am Trying to build my First application by Entity Framework 6 Code First using MVC 5 but I have a problem, my application is online restaurant which contains Items class and it contains itemprice and itemamount and I would like to calculate its value itemprice*itemamount to be saved in total cost in Orders class, How I can do that in the initializer[enter image description here][1]???
var Items = new List<MenuItem>
{
new MenuItem { ItemName = "Cheese Piza", Itemdesrciption="Pizza with cheese", MenuID=int.Parse("3"), ItemPrice=Decimal.Parse("15.5"), ItemAmount=int.Parse("2")},
new MenuItem { ItemName = "Bolinez Pasta", Itemdesrciption="pasta with red sous", MenuID=int.Parse("3"),ItemPrice=Decimal.Parse("20.45"), ItemAmount=int.Parse("3")},
new MenuItem { ItemName = "Holy Cake", Itemdesrciption="Cake with choklet sous", MenuID=int.Parse("3"), ItemPrice=Decimal.Parse("45.5"), ItemAmount=int.Parse("1")},
};
Items.ForEach(I => context.Item.Add(I));
context.SaveChanges();
var Orderss = new List<Order>
{
new Order { CustomerID = int.Parse("1"), ItemID=int.Parse("3"), OrderDate= DateTime.Parse("2005-09-01"),
TotalPrice = },
};