public async Task <Result> DeleteDeveloperAsync(Guid id) { var existDeveloper = await _developerRepository.ExistAsync(id); if (!existDeveloper) { return(new Result(Status.NotFund, $"Developer with {nameof(id)} does not exist")); } var developer = await _developerRepository.GetByIdAsync(id); await _developerRepository.DeleteAsync(developer); return(new Result()); }
public async Task <bool> Remove(Guid id) { var developer = await _developerRepository.GetByIdAsync(id); if (developer == null) { return(false); } _developerValidation.ValidationOnRemoving(developer); await _developerRepository.DeleteAsync(id); await _developerRepository.SaveChangesAsync(); return(true); }
public async Task <ICommandResult> Handle(DeleteDeveloperCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "Operação inválida", command.Notifications)); } var developerDb = await _developerRepository.GetByIdAsync(command.Id); if (developerDb == null) { return(new GenericCommandResult(false, "Desenvolvedor não encontrado", command.Notifications)); } await _developerRepository.DeleteAsync(command.Id); return(new GenericCommandResult(true, "Desenvolvedor removido com sucesso", developerDb)); }
public async Task <bool> DeleteAsync(DeveloperModel entity) { return(await _repository.DeleteAsync(entity)); }
public async Task DeleteAsync(int id) { await repo.DeleteAsync(id); }