public ActionResult Create(ExternalCreate ex) { var service = new ExternalService(); if (ModelState.IsValid) { service.CreateExternal(ex); return(RedirectToAction("Index")); } return(View(ex)); }
// Create public bool CreateExternal(ExternalCreate model) { ExternalStorage entity = new ExternalStorage { Name = model.Name, Manufacturer = model.Manufacturer, Interface = model.Interface, Capacity = model.Capacity, Type = model.Type, Color = model.Color, IsPortiable = model.IsPortiable, IsAvailable = model.IsAvailable }; _db.ExternalStorages.Add(entity); return(_db.SaveChanges() == 1); }