public TemplateMaterialCreateNewVm() { var vm = new FanMaterialCostBases(); var orderNumber = 5; var itemID = 1001; foreach (var fan in vm.Values) { var material = new EST_Cost_Template_Material { // public int TemplateID { get; set; } // ProductID = 263, //Halo Effect Channel Letter TypeID = 120, OrderNumber = orderNumber, DbItemID = itemID, Qty = 1, Name = fan.CostItemName, Unit = fan.Unit, UnitPrice = fan.UnitPrice, Active = true, }; _db.EST_Cost_Template_Material.Add(material); orderNumber += 5; itemID += 1; } _db.SaveChanges(); }
public DbMaterialCreateNewVm() { var vm = new FanMaterialCostBases(); foreach (var fan in vm.Values) { var material = new SpecDomain.Model.Material() { //public int DbItemID { get; set; } //TypeID = 120, //Name = fan.CostItemName, //Unit = fan.Unit, //UnitPrice = fan.UnitPrice, }; _db.Materials.Add(material); } _db.SaveChanges(); }