Ejemplo n.º 1
0
        public ActionResult <AddressReadDto> CreateAddress(AddressCreateDto addressCreateDto)
        {
            var address = _mapper.Map <Address>(addressCreateDto);

            _repository.CreateAddress(address);
            _repository.SaveChanges();

            var addressReadDto = _mapper.Map <AddressReadDto>(address);

            return(NoContent()); //CreatedAtRoute(nameof(GetAddressById), new { Id = addressReadDto.Id }, addressReadDto);
        }
Ejemplo n.º 2
0
        public ActionResult <AddressCreateDto> CreateAddress(AddressCreateDto addressCreateDto)
        {
            var AddrModel = _addrMapper.Map <Address>(addressCreateDto);

            _addrRepo.CreateAddress(AddrModel);
            _addrRepo.SaveChanges();

            var addrReadDto = _addrMapper.Map <AddressReadDto>(AddrModel);

            return(CreatedAtRoute(nameof(GetAddrById), new { Id = addrReadDto.Id }, addrReadDto));
        }