public ActionResult Create([Bind(Include = "SerialId,Make,Model,PriceExBtw,CreationDate,MbSize,DisplayWidth,DisplayHeight,TotalPixels,IsEjected")] VMCdDiscMan vMCdDiscMan) { if (ModelState.IsValid) { var device = new AudioDevices.AudioDevice() { Make = vMCdDiscMan.Make, Model = vMCdDiscMan.Model, CreationDate = vMCdDiscMan.CreationDate, PriceExBtw = vMCdDiscMan.PriceExBtw, BtwPrecentage = (decimal)vMCdDiscMan.BtwPercentage, SerialId = vMCdDiscMan.SerialId }; var recorder = new CdDiskMan() { MbSize = vMCdDiscMan.MbSize, DisplayWidth = vMCdDiscMan.DisplayWidth, DisplayHeight = vMCdDiscMan.DisplayHeight, IsEjected = vMCdDiscMan.IsEjected, AudioDevice = device, AudioDeviceId = vMCdDiscMan.SerialId }; db.AudioDevice.Add(device); db.CdDiskMan.Add(recorder); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vMCdDiscMan)); }
public ActionResult Create([Bind(Include = "SerialId,Make,Model,PriceExBtw,BtwPercentage,CreationDate,TracklistId,MbSize,DisplayWidth,DisplayHeight")] VMMp3Player vMMp3Player) { if (ModelState.IsValid) { var device = new AudioDevices.AudioDevice() { Make = vMMp3Player.Make, Model = vMMp3Player.Model, CreationDate = vMMp3Player.CreationDate, PriceExBtw = vMMp3Player.PriceExBtw, BtwPrecentage = (decimal)vMMp3Player.BtwPercentage, SerialId = vMMp3Player.SerialId }; var recorder = new Mp3Player() { MbSize = vMMp3Player.MbSize, DisplayWidth = vMMp3Player.DisplayWidth, DisplayHeight = vMMp3Player.DisplayHeight, TrackList = vMMp3Player.TrackListId, AudioDevice = device }; db.AudioDevice.Add(device); db.Mp3Player.Add(recorder); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TracklistId = new SelectList(db.TrackList, "ID", "Name", vMMp3Player.TrackListId); return(View(vMMp3Player)); }