public void Setup() { validEntity = new Domain.Entities.Company(1, "Estacionamento e cia ltda", "17110897000109", "Rua Dom Pedro II, 518 - Jardim Netinho Prado - Jaú - SP", "1427963861", 43, 20); handlerError = new CompanyCommandHandler(new ErrorCompanyRepository(), new ErrorCompanyVehicleRepository()); handlerSuccess = new CompanyCommandHandler(new SuccessCompanyRepository(), new ErrorCompanyVehicleRepository()); removeCommand = new RemoveCompanyCommand(10); }
public async Task <bool> Handler(RemoveCompanyCommand command) { if (command.Id == 0) { AddNotification("", "Estabelecimento inexistente"); return(false); } await _companyVehicleRepository.DeleteByCompanyId(command.Id); var result = await _repository.Delete(command.Id); if (!result) { AddNotification("", "Erro ao remover o estabelecimento"); return(false); } return(true); }