Beispiel #1
0
        public void DeleteCharacter()
        {
            _characterRepository.Delete(Arg.Any <int>());
            _unitOfWork.Commit().Returns(true);

            var result = _service.Delete(1);

            Assert.True(result);
            _characterRepository.Received().Delete(Arg.Any <int>());
            _unitOfWork.Received().Commit();
        }
Beispiel #2
0
 public Option <SuccessResult, ErrorResult> Delete(DeleteByIdCommand command)
 {
     return(_deleteByIdCommandValidator
            .Validate(command)
            .OnSuccess(errorBuilder =>
     {
         var option = _characterRepository.GetById(command);
         option.MatchSome(x => _characterRepository.Delete(x));
         option.MatchNone(errorBuilder.AddRecordNotFound);
     }));
 }
Beispiel #3
0
 public async Task Delete(int id)
 {
     try
     {
         await _CharacterRepository.Delete(id);
     }
     catch (Exception ex)
     {
         File.WriteAllText("log.txt", ex.Message + " - " + ex.StackTrace);
         throw new Exception("Erro no banco de dados, contate o administrador");
     }
 }
        private void DeleteCharacter()
        {
            int id = io.PromptUserForInt("Enter Id to remove");

            repo.Delete(id);
            Character deletedInfo = repo.ReadById(io.PromptUserForInt("Enter Id for character"));

            if (deletedInfo == null)
            {
                Console.WriteLine("No character found");
            }
        }
Beispiel #5
0
        public async Task <IResponse> Handle(DeleteCharacterCommand command)
        {
            command.Validate();

            if (command.Invalid)
            {
                return(new GenericCommandResponse(false, "Comando Inválido", command.Notifications));
            }

            await _characterRepository.Delete(command.Id);

            return(new GenericCommandResponse(true, "OK", command));
        }
Beispiel #6
0
 public IActionResult Delete(int id)
 {
     if (!_loginManager.IsLoggedIn(HttpContext?.Session) || !_repo.Read().Any(c =>
                                                                              c.OwningPlayerid == HttpContext.Session.GetInt32(ContextData.PlayerId.ToString()) &&
                                                                              c.Id == id)) //ensure they do own the character.
     {
         return(RedirectToAction("Login", "Player"));
     }
     _repo.Delete(new Character()
     {
         Id = id
     });
     return(RedirectToAction("Index"));
 }
        /// <summary>
        /// delete a character from the data file
        /// </summary>
        /// <param name="character">character</param>
        /// <param name="dalErrorCode">status code</param>
        /// <param name="message">message</param>
        public void DeleteCharacter(int id, out DalErrorCode dalErrorCode, out string message)
        {
            message = "";

            using (_characterRepository)
            {
                if (CharacterDocumentExists(id, out dalErrorCode))
                {
                    _characterRepository.Delete(id, out dalErrorCode);

                    if (dalErrorCode == DalErrorCode.ERROR)
                    {
                        message = "There was an error connecting to the data file.";
                    }
                }
                else
                {
                    message      = $"Character with id {id} does not exist.";
                    dalErrorCode = DalErrorCode.ERROR;
                }
            }
        }
        public async Task DeleteAsync(int id)
        {
            Character?characterToDelete = await _characterRepository.FindAsync(id);

            _characterRepository.Delete(characterToDelete);
        }
Beispiel #9
0
        public bool Delete(int id)
        {
            _repository.Delete(id);

            return(_unitOfWork.Commit());
        }
Beispiel #10
0
 public void DeleteCharacter(string name)
 {
     _repository.Delete(name);
 }
Beispiel #11
0
 public void Delete(int id)
 {
     _globalService.Delete(id);
 }
Beispiel #12
0
        public IActionResult Delete(Guid id)
        {
            repository.Delete(id);

            return(new NoContentResult());
        }
 public void DeleteCharacter(int id)
 {
     _characterRepository.Delete(id);
 }
Beispiel #14
0
 public void Delete(int id)
 {
     _service.Delete(id);
 }