Esempio n. 1
0
        // POST api/pet
        public async Task <JsonResult <PetsViewModel> > Post([FromBody] PetPostViewModel data)
        {
            await _DBservice.CreateNewPet(data.newPet, data.ownerId);

            IEnumerable <Pet> pets = await _DBservice.GetPets(data.ownerId);

            return(Json(new PetsViewModel
            {
                NumberOfPets = pets.Count(),
                Pets = pets
            }));
        }