public ActionResult Create(InternalCreate ex)
        {
            var service = new InternalService();

            if (ModelState.IsValid)
            {
                service.CreateInternal(ex);
                return(RedirectToAction("Index"));
            }
            return(View(ex));
        }
示例#2
0
        // Create
        public bool CreateInternal(InternalCreate model)
        {
            InternalStorage entity = new InternalStorage
            {
                Name         = model.Name,
                Manufacturer = model.Manufacturer,
                Interface    = model.Interface,
                Capacity     = model.Capacity,
                Type         = model.Type,
                FormFactor   = model.FormFactor,
                NVME         = model.NVME,
                IsAvailable  = model.IsAvailable
            };

            _db.InternalStorages.Add(entity);
            return(_db.SaveChanges() == 1);
        }