public async Task <bool> DeleteSong(int id) { if (await _repository.DeleteSong(id)) { return(true); } throw new NotImplementedException(); }
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")); }
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")); }
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"))); } }
public IHttpActionResult Delete(int id) { bool deleteSuccess; try { deleteSuccess = _songRepository.DeleteSong(id); } catch (Exception e) { return(InternalServerError(e)); } if (!deleteSuccess) { return(NotFound()); } return(Ok()); }
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()); }
public JsonResult AjaxDelete(long songId) { _songRepository.DeleteSong(songId); return(new JsonResult()); }
public async Task DeleteSong(int song_id) { await songRepository.DeleteSong(song_id); await songRepository.SaveChangesAsync(); }
public bool DeleteSong(int id) { GetSong(id); repository.DeleteSong(id); return(true); }
public IActionResult Delete(int id) { _songRepository.DeleteSong(id); return(new OkResult()); }