public override void RevertChanges() { SetupViewModel.RevertChanges(); InputOutputViewModel.RevertChanges(); USBViewModel.RevertChanges(); MIDIViewModel.RevertChanges(); }
public override void ApplyChanges <T>(T model) { if (model is SystemModel system) { SetupViewModel.ApplyChanges(system.Setup); InputOutputViewModel.ApplyChanges(system.InputOutput); USBViewModel.ApplyChanges(system.USB); MIDIViewModel.ApplyChanges(system.MIDI); } else { throw new ArgumentException("Model must be of type SystemModel."); } }
public ActionResult Create(USBViewModel collection) { try { dtbs15Entities db = new dtbs15Entities(); USB bc = new USB(); bc.Type = collection.Type; db.USBs.Add(bc); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: USB public ActionResult Index() { dtbs15Entities db = new dtbs15Entities(); var ca = db.USBs.ToList(); List <USBViewModel> bc = new List <USBViewModel>(); foreach (var c in ca) { USBViewModel b = new USBViewModel(); b.id = c.id; b.Type = c.Type; bc.Add(b); } return(View(bc)); }