コード例 #1
0
ファイル: SongManager.cs プロジェクト: gngo2018/RBB_B
 public async Task <bool> DeleteSong(int id)
 {
     if (await _repository.DeleteSong(id))
     {
         return(true);
     }
     throw new NotImplementedException();
 }
コード例 #2
0
ファイル: SongController.cs プロジェクト: Maxspell/IvanovBand
        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"));
        }
コード例 #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"));
        }
コード例 #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")));
            }
        }
コード例 #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());
        }
コード例 #6
0
ファイル: SongController.cs プロジェクト: AsaVault/EarTube
        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());
        }
コード例 #7
0
 public JsonResult AjaxDelete(long songId)
 {
     _songRepository.DeleteSong(songId);
     return(new JsonResult());
 }
コード例 #8
0
        public async Task DeleteSong(int song_id)
        {
            await songRepository.DeleteSong(song_id);

            await songRepository.SaveChangesAsync();
        }
コード例 #9
0
 public bool DeleteSong(int id)
 {
     GetSong(id);
     repository.DeleteSong(id);
     return(true);
 }
コード例 #10
0
ファイル: SongController.cs プロジェクト: Aigul9/vinyl-store
 public IActionResult Delete(int id)
 {
     _songRepository.DeleteSong(id);
     return(new OkResult());
 }