public ActionResult Add(Petowner newOwner)
        {
            if (ModelState.IsValid)
            {
                int ownerId = 1;
                List<Petowner> owners = _db.Petowners.ToList();

                foreach (var owner in owners)
                {
                    if (ownerId == owner.PetOwnerID)    //checks if the id matches a current id in the db
                    {
                        ++ownerId;  //increments the id to ensure a unique id
                    }

                }

                newOwner.PetOwnerID = ownerId;
                _db.Petowners.Add(newOwner);
                _db.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(newOwner);
        }
 public ActionResult Edit(Petowner owner)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(owner).State = System.Data.Entity.EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(owner);
 }