コード例 #1
0
        public async Task <IActionResult> Register(Pet pet)
        {
            if (authorizationRepository.Exists(pet.Name))
            {
                return(BadRequest("Użytkownik o tej nazwie już istnieje. Wybierz inną."));
            }

            var newPet = await authorizationRepository.Register(pet);

            var PetDTO = mapper.Map <PetDTO>(pet);

            //return StatusCode(201);
            return(CreatedAtRoute("GetPet", new { controller = "Pets", petId = newPet.Id }, PetDTO));
        }