Esempio n. 1
0
        //
        // GET: /Bands/Create

        public ActionResult Create()
        {
            var model = new BandEditModel {
                ArtistCheckedList = GetArtistCheckBoxes()
            };

            return(View(model));
        }
Esempio n. 2
0
        //
        // GET: /Bands/Edit/5

        public ActionResult Edit(int id)
        {
            BandEditModel model = new BandEditModel {
                Band = bandRepository.GetById(id)
            };

            model.ArtistCheckedList = GetArtistCheckBoxes(id);
            return(View(model));
        }
Esempio n. 3
0
 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));
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 //
 // GET: /Bands/Create
 public ActionResult Create()
 {
     var model = new BandEditModel {ArtistCheckedList = GetArtistCheckBoxes()};
     return View(model);
 }
Esempio n. 6
0
 //
 // GET: /Bands/Edit/5
 public ActionResult Edit(int id)
 {
     BandEditModel model = new BandEditModel {Band = bandRepository.GetById(id)};
     model.ArtistCheckedList = GetArtistCheckBoxes(id);
     return View(model);
 }