Ejemplo n.º 1
0
 public ActionResult Delete(int id)
 {
     try
     {
         _petsRepo.Delete(id);
         return(View("Index"));
     }
     catch
     {
         return(HttpNotFound());
     }
 }
Ejemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            PetsRepository repo = new PetsRepository();
            Pet            item = repo.GetById(id);

            if (AuthenticationManager.LoggedUser.Id != 1 &&
                AuthenticationManager.LoggedUser.Id != item.UserId)
            {
                RedirectToAction("Login", "Home");
            }
            else
            {
                repo.Delete(item);
            }

            return(RedirectToAction("Index", "Pet"));
        }