Exemplo n.º 1
0
        public async Task <IResult> AddForeignIndividualAsync(CurrentCardAndForeignIndividualAddDto currentCardAndForeignIndividualAddDto)
        {
            var currentCardAddResult = await this.AddCurrentCardAsync(currentCardAndForeignIndividualAddDto.CurrentCardAddDto);

            if (!currentCardAddResult.Success)
            {
                return(currentCardAddResult);
            }

            currentCardAndForeignIndividualAddDto.IndividualCurrentCardAddDto.CurrentCardId = currentCardAddResult.Data.Id;

            var individualCurrentCardAddResult = await this.AddIndividualCurrentCardAsync(currentCardAndForeignIndividualAddDto.IndividualCurrentCardAddDto);

            if (!individualCurrentCardAddResult.Success)
            {
                return(individualCurrentCardAddResult);
            }

            currentCardAndForeignIndividualAddDto.ForeignIndividualCurrentCardAddDto.IndividualCurrentCardId = individualCurrentCardAddResult.Data.Id;

            var foreignIndividualAddResult = await _foreignIndividualCurrentCardService.AddAsync(currentCardAndForeignIndividualAddDto.ForeignIndividualCurrentCardAddDto);

            if (!foreignIndividualAddResult.Success)
            {
                return(foreignIndividualAddResult);
            }

            return(new SuccessResult(Messages.ForeignIndividualCurrentCardAdded));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddLocalIndividualAsync(CurrentCardAndForeignIndividualAddDto currentCardAndForeignIndividualAddDto)
        {
            var addResult = await _currentCardManagementService.AddForeignIndividualAsync(currentCardAndForeignIndividualAddDto);

            if (!addResult.Success)
            {
                return(BadRequest(addResult));
            }

            return(Ok(addResult));
        }