예제 #1
0
        //Create
        public bool CreateVideoCard(VideoCardCreate model)
        {
            VideoCard entity = new VideoCard
            {
                Name               = model.Name,
                Manufacturer       = model.Manufacturer,
                Chipset            = model.Chipset,
                MemoryType         = model.MemoryType,
                CoreClock          = model.CoreClock,
                BoostClock         = model.BoostClock,
                SLICrossfire       = model.SLICrossfire,
                FrameSync          = model.FrameSync,
                Length             = model.Length,
                ThermalDesignPower = model.ThermalDesignPower,
                DVIPorts           = model.DVIPorts,
                HDMIPorts          = model.HDMIPorts,
                MiniHDMIPorts      = model.MiniHDMIPorts,
                DisplayPorts       = model.DisplayPorts,
                ExpansionSlotWidth = model.ExpansionSlotWidth,
                Cooling            = model.Cooling,
                IsAvailable        = model.IsAvailable
            };

            _db.VideoCards.Add(entity);
            return(_db.SaveChanges() == 1);
        }
예제 #2
0
        public ActionResult Create(VideoCardCreate vid)
        {
            var service = new VideoCardService();

            if (ModelState.IsValid)
            {
                service.CreateVideoCard(vid);
                return(RedirectToAction("Index"));
            }
            return(View(vid));
        }