public ActionResult <AddressReadDto> CreateAddress(AddressCreateDto req) { var addressModel = _mapper.Map <Address>(req); _repository.CreateAddress(addressModel); _repository.SaveChanges(); var addressReadDto = _mapper.Map <AddressReadDto>(addressModel); return(CreatedAtRoute(nameof(GetAddressById), new { Id = addressReadDto.Id }, addressReadDto)); }
public ActionResult <UsaStateReadDto> CreateUsaState(UsaStateCreateDto req) { var usastatesModel = _mapper.Map <UsaState>(req); _repository.CreateUsaState(usastatesModel); _repository.SaveChanges(); var usastatesReadDto = _mapper.Map <UsaStateReadDto>(usastatesModel); return(CreatedAtRoute(nameof(GetUsaStateById), new { Id = usastatesReadDto.Id }, usastatesReadDto)); }