Exemple #1
0
        //GET /Detail
        //GET /Edit
        //public ActionResult Edit(int id)
        //{
        //    var service = new SongPlaylistService();
        //    var detail = service.DeleteSongFromPlaylist(id);
        //    var model =
        //        new SongPlaylistEdit
        //        {
        //            SongID = detail.

        //        };

        //    return View(model);
        //}
        //POST /Edit
        //GET /Delete
        public ActionResult Delete(int id)
        {
            var svc   = new SongPlaylistService();
            var model = svc.DeleteSongFromPlaylist(id);

            return(View(model));
        }
Exemple #2
0
        // GET: SongPlaylist
        public ActionResult Index()
        {
            var service = new SongPlaylistService();
            var model   = service.GetAllSongsInPlaylist();

            return(View(model));
        }
Exemple #3
0
        public ActionResult DeleteSongFromPlaylist(int id)
        {
            var service = new SongPlaylistService();

            service.DeleteSongFromPlaylist(id);
            TempData["SaveResult"] = "Song has been deleted from playlist";
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult Create(SongPlaylistCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new SongPlaylistService();

            if (service.AddSongsToPlaylist(model))
            {
                TempData["SaveResult"] = "Song has been added to playlist";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Song was not added to playlist");
            return(View(model));
        }