Example #1
0
        public ActionResult EditSong(int id)
        {
            SongDTO                      songDto   = songService.Get(id);
            SongViewModel                song      = Mapper.Map <SongDTO, SongViewModel>(songDto);
            IEnumerable <ChordDTO>       chordDtos = chordService.GetAllBySongId(id);
            IEnumerable <ChordViewModel> chords    = Mapper.Map <IEnumerable <ChordDTO>, IEnumerable <ChordViewModel> >(chordDtos);

            song.Chords = chords;
            IEnumerable <ChordDTO>       allChordsDtos = chordService.GetAll();
            IEnumerable <ChordViewModel> allChords     = Mapper.Map <IEnumerable <ChordDTO>, IEnumerable <ChordViewModel> >(allChordsDtos);

            ViewBag.AllChords = allChords;
            return(View(song));
        }