public ActionResult DeleteConfirmed(int id) { songRepository.Delete(id); songRepository.Save(); return(RedirectToAction("Index")); }
public bool Delete(int id) { var song = _repository.FindById(id); _repository.Delete(song); return(_repository.SaveChanges()); }
public void Delete(string id) { var songDetails = _songRepository.GetById(id); if (songDetails == null) { throw new NotFoundException(Messages.InvalidSongId); } _songRepository.Delete(id); }
public ICommandResult Handle(DeleteSongCommand command) { bool result = _repository.Delete(command.Id); if (!result) { return(new CommandResult(false, MessagesUtil.DeleteError)); } return(new CommandResult(true, MessagesUtil.DeletedSuccess)); }
public async Task <OperationResult <SongDTO> > Delete(int id) { var song = await songRepository.GetById(id); if (song == null) { return(OperationResult <SongDTO> .CreateNonSuccessResult("No song with the given id was found")); } await songRepository.Delete(song); return(OperationResult <SongDTO> .CreateSuccessResult()); }
public IActionResult Delete(int id) { var song = _songRepository.GetById(id); if (song == null) { return(NotFound("No Record Found matching this Id...")); } _songRepository.Delete(song); return(Ok("Song Deleted...")); }
public async Task <ServiceResult> Delete(string id) { var serviceResult = new ServiceResult(); var result = await _songRepository.Delete(id); serviceResult.Success = result.Success; if (!result.Success) { serviceResult.Error.Code = ErrorStatusCode.BudRequest; serviceResult.Error.Description = result.Message; } return(serviceResult); }
public IActionResult Remove(Guid ID) { var reposong = _songRepository.GetSingle(ID); if (reposong == null) { return(NotFound()); } _songRepository.Delete(ID); bool result = _songRepository.Save(); if (!result) { return(new StatusCodeResult(500)); } return(NoContent()); }
public ActionResult Delete(int?id, Song song) { if (!id.HasValue) { return(RedirectToAction("Index")); } if (!ModelState.IsValid) { return(View(song)); } var dbSong = _songRepository.GetById(id.Value); if (dbSong == null) { return(RedirectToAction("Index")); } _songRepository.Delete(dbSong); _songRepository.Update(song); return(RedirectToAction("Index")); }
public ActionResult Delete(Song song) { repo.Delete(song); return(RedirectToAction("Index")); }
public bool Delete(ObjectId id) { return(_songRepository.Delete(id)); }
public Song Delete(int id) { Song model = ISongRepository.Get(id); return(ISongRepository.Delete(model)); }
public ActionResult Delete(int id, SongModel songModel) { _songRepository.Delete(id); return(RedirectToAction(nameof(Index))); }