Exemple #1
0
        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);
        }
Exemple #2
0
        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;
        }