Ejemplo n.º 1
0
        public ActionResult Save(PetModel pet)
        {
            if (!ModelState.IsValid)
            {
                return(View("PetForm", pet));
            }
            try
            {
                _petsRepo.AddOrUpdate(pet);
            }
            catch (Exception e)
            {
                return(HttpNotFound());
            }


            if (pet.Id == 0)
            {
                return(RedirectToAction("Index", "Pet"));
            }

            return(RedirectToAction("Show", new { id = pet.Id }));
        }