// // GET: /Bands/Create public ActionResult Create() { var model = new BandEditModel { ArtistCheckedList = GetArtistCheckBoxes() }; return(View(model)); }
// // GET: /Bands/Edit/5 public ActionResult Edit(int id) { BandEditModel model = new BandEditModel { Band = bandRepository.GetById(id) }; model.ArtistCheckedList = GetArtistCheckBoxes(id); return(View(model)); }
public ActionResult Edit(BandEditModel bandEditModel) { if (ModelState.IsValid) { bandRepository.InsertOrUpdate(bandEditModel.Band); bandRepository.Save(); bandRepository.UpdateArtists(bandEditModel.Band.Id, bandEditModel.ArtistCheckedList); return(RedirectToAction("Index")); } else { return(View(bandEditModel)); } }
public ActionResult Create(BandEditModel bandEditModel) { if (ModelState.IsValid) { bandRepository.InsertOrUpdate(bandEditModel.Band); bandRepository.Save(); //Update the artists bandRepository.UpdateArtists(bandEditModel.Band.Id, bandEditModel.ArtistCheckedList); return RedirectToAction("Index"); } else { return View(bandEditModel); } return View(bandEditModel); }
// // GET: /Bands/Create public ActionResult Create() { var model = new BandEditModel {ArtistCheckedList = GetArtistCheckBoxes()}; return View(model); }
// // GET: /Bands/Edit/5 public ActionResult Edit(int id) { BandEditModel model = new BandEditModel {Band = bandRepository.GetById(id)}; model.ArtistCheckedList = GetArtistCheckBoxes(id); return View(model); }