Esempio n. 1
0
        public async Task <ActionResult <AddressRegisterDto> > UpdatePersonAddress(AddressRegisterDto addressDto)
        {
            CandidateViewModel candidate = await GetCandidateById(_candidateId);

            if (candidate == null)
            {
                return(NotFound());
            }
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            var command = new UpdateAddressCandidateCommand(addressDto.Id,
                                                            candidate.Id, addressDto.CountryId,
                                                            addressDto.ZipCode, addressDto.District,
                                                            addressDto.Street, addressDto.Number,
                                                            addressDto.Complement, addressDto.State,
                                                            addressDto.City);

            var response = await _mediatorHandler.SendCommand(command);

            if (!response.IsValid)
            {
                return(CustomResponse(response));
            }
            return(CustomResponse(addressDto));
        }
Esempio n. 2
0
 public async Task AddAddress(Guid personId, AddressRegisterDto addressRegisterDto)
 {
     await _personService.AddAddress(personId, _mapper.Map <Address>(addressRegisterDto));
 }