Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            songRepository.Delete(id);
            songRepository.Save();

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public bool Delete(int id)
        {
            var song = _repository.FindById(id);

            _repository.Delete(song);
            return(_repository.SaveChanges());
        }
Esempio n. 3
0
        public void Delete(string id)
        {
            var songDetails = _songRepository.GetById(id);

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

            _songRepository.Delete(id);
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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());
        }
Esempio n. 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..."));
        }
        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);
        }
Esempio n. 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());
        }
Esempio n. 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"));
        }
Esempio n. 10
0
 public ActionResult Delete(Song song)
 {
     repo.Delete(song);
     return(RedirectToAction("Index"));
 }
Esempio n. 11
0
 public bool Delete(ObjectId id)
 {
     return(_songRepository.Delete(id));
 }
        public Song Delete(int id)
        {
            Song model = ISongRepository.Get(id);

            return(ISongRepository.Delete(model));
        }
Esempio n. 13
0
        public ActionResult Delete(int id, SongModel songModel)
        {
            _songRepository.Delete(id);

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