コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            songRepository.Delete(id);
            songRepository.Save();

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public bool Delete(int id)
        {
            var song = _repository.FindById(id);

            _repository.Delete(song);
            return(_repository.SaveChanges());
        }
コード例 #3
0
        public void Delete(string id)
        {
            var songDetails = _songRepository.GetById(id);

            if (songDetails == null)
            {
                throw new NotFoundException(Messages.InvalidSongId);
            }

            _songRepository.Delete(id);
        }
コード例 #4
0
ファイル: SongHandler.cs プロジェクト: andrade-lucas/FreeTone
        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));
        }
コード例 #5
0
ファイル: SongService.cs プロジェクト: salberts93/MusicStore
        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());
        }
コード例 #6
0
        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..."));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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());
        }
コード例 #9
0
        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"));
        }
コード例 #10
0
 public ActionResult Delete(Song song)
 {
     repo.Delete(song);
     return(RedirectToAction("Index"));
 }
コード例 #11
0
 public bool Delete(ObjectId id)
 {
     return(_songRepository.Delete(id));
 }
コード例 #12
0
        public Song Delete(int id)
        {
            Song model = ISongRepository.Get(id);

            return(ISongRepository.Delete(model));
        }
コード例 #13
0
        public ActionResult Delete(int id, SongModel songModel)
        {
            _songRepository.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }