示例#1
0
        public async Task <IActionResult> Post([FromBody] PetDto model)
        {
            var pet = await _petsRepository.InsertPetAsync(AutoMapper.Mapper.Map <Pet>(model));

            var petToReturn = AutoMapper.Mapper.Map <PetDto>(pet);

            petToReturn.PopulateLinks(_urlHelper);

            return(CreatedAtRoute("GetPetById", new { id = petToReturn.Id }, petToReturn));
        }