예제 #1
0
        private int InsertVideoCard()
        {
            string video         = this.boxSet.GetVideoCardAndVideoCardProducer().Item1;
            string videoProducer = this.boxSet.GetVideoCardAndVideoCardProducer().Item2;

            CustomComputersAspEntities db = new CustomComputersAspEntities();
            VideoCard match = db.VideoCards.FirstOrDefault(v => v.name == video && v.producer == videoProducer);

            if (match == null)
            {
                db.AddToVideoCards(new VideoCard()
                {
                    name     = video,
                    producer = videoProducer
                });
                db.SaveChanges();
                match = db.VideoCards.FirstOrDefault(v => v.name == video && v.producer == videoProducer);
            }
            return(match.id);
        }
예제 #2
0
        private int InsertVideoCard()
        {
            string video = this.boxSet.GetVideoCardAndVideoCardProducer().Item1;
            string videoProducer = this.boxSet.GetVideoCardAndVideoCardProducer().Item2;

            CustomComputersAspEntities db = new CustomComputersAspEntities();
            VideoCard match = db.VideoCards.FirstOrDefault(v => v.name == video && v.producer == videoProducer);
            if (match == null)
            {
                db.AddToVideoCards(new VideoCard()
                {
                    name = video,
                    producer = videoProducer
                });
                db.SaveChanges();
                match = db.VideoCards.FirstOrDefault(v => v.name == video && v.producer == videoProducer);
            }
            return match.id;
        }