Exemplo n.º 1
0
 public async Task <bool> DeleteSong(int id)
 {
     if (await _repository.DeleteSong(id))
     {
         return(true);
     }
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
        public ActionResult Delete(int songId)
        {
            Song song = repository.Songs.FirstOrDefault(s => s.SongID == songId);

            if (song != null)
            {
                repository.DeleteSong(song);
                TempData["message"] = string.Format("{0} was deleted", song.Title);
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult DeleteSong(int SongId)
        {
            Song song = songRepository.Songs.First(s => s.SongId == SongId);

            if (song != null)
            {
                artistRepository.DecreseSongCounter(new Artist {
                    ArtistId = song.ArtistId
                });
                songRepository.DeleteSong(song);
            }
            return(RedirectToAction("SongList", "Admin"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> DeleteSong(int songId)
        {
            try
            {
                await SongRepository.DeleteSong(songId);

                return(Ok(new ApiOKResponse("Record deleted")));
            }
            catch (ApplicationException)
            {
                return(NotFound(new ApiResponse(404, "No song with that id")));
            }
        }
Exemplo n.º 5
0
        public IHttpActionResult Delete(int id)
        {
            bool deleteSuccess;

            try
            {
                deleteSuccess = _songRepository.DeleteSong(id);
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }

            if (!deleteSuccess)
            {
                return(NotFound());
            }
            return(Ok());
        }
Exemplo n.º 6
0
        public async Task <IActionResult> DeleteSong(int?id, bool isSuccess = false)
        {
            ViewBag.IsSuccess = isSuccess;

            if (id == null)
            {
                return(NotFound());
            }

            var data = await _songRepository.GetSongById(id);

            int removeSong = await _songRepository.DeleteSong(data);

            if (removeSong > 0)
            {
                return(RedirectToAction(nameof(GetAllSongs), new { isSuccess = true }));
            }

            return(NotFound());
        }
Exemplo n.º 7
0
 public JsonResult AjaxDelete(long songId)
 {
     _songRepository.DeleteSong(songId);
     return(new JsonResult());
 }
Exemplo n.º 8
0
        public async Task DeleteSong(int song_id)
        {
            await songRepository.DeleteSong(song_id);

            await songRepository.SaveChangesAsync();
        }
Exemplo n.º 9
0
 public bool DeleteSong(int id)
 {
     GetSong(id);
     repository.DeleteSong(id);
     return(true);
 }
Exemplo n.º 10
0
 public IActionResult Delete(int id)
 {
     _songRepository.DeleteSong(id);
     return(new OkResult());
 }