public IActionResult Index(PuppyViewModel vm)
 {
     if (ModelState.IsValid)
     {
         puppyDao.AddPuppy(vm.NewPuppy);
         return(RedirectToAction("Index"));
     }
     vm.Puppies = puppyDao.GetPuppies();
     return(View(vm));
 }
        public IActionResult AddPuppy(Puppy puppy)
        {
            if (ModelState.IsValid)
            {
                int newId = puppyDao.AddPuppy(puppy);

                puppy = puppyDao.GetPuppy(newId);

                // Returns 201 Created

                return(CreatedAtRoute("GetPuppy", new { id = newId }, puppy));
            }
            else
            {
                // Sends errors to client program
                return(new BadRequestObjectResult(ModelState));
            }
        }