private int InsertHdd() { string hdd = this.boxSet.GetHddAndHddProducer().Item1; string hddProducer = this.boxSet.GetHddAndHddProducer().Item2; CustomComputersAspEntities db = new CustomComputersAspEntities(); Hdd match = db.Hdds.FirstOrDefault(h => h.name == hdd && h.producer == hddProducer); if (match == null) { db.AddToHdds(new Hdd() { name = hdd, producer = hddProducer }); db.SaveChanges(); match = db.Hdds.FirstOrDefault(h => h.name == hdd && h.producer == hddProducer); } return(match.id); }
private int InsertHdd() { string hdd = this.boxSet.GetHddAndHddProducer().Item1; string hddProducer = this.boxSet.GetHddAndHddProducer().Item2; CustomComputersAspEntities db = new CustomComputersAspEntities(); Hdd match = db.Hdds.FirstOrDefault(h => h.name == hdd && h.producer == hddProducer); if (match == null) { db.AddToHdds(new Hdd() { name = hdd, producer = hddProducer }); db.SaveChanges(); match = db.Hdds.FirstOrDefault(h => h.name == hdd && h.producer == hddProducer); } return match.id; }