public string DeleteData(int id) { try { PetLogic _petLogic = new PetLogic(); if (_petLogic.DeletePet(id) ) return "ok"; else return "The Given Pet Not Found"; } catch (Exception exp) { return exp.GetType().Equals(typeof(ArgumentNullException)) ? "The Given Pet Not Found" : exp.Message; } }
public ActionResult DeleteConfirmed(int id) { _logic = new PetLogic(); //Pet pet = _logic.GetPetById(id); _logic.DeletePet(id); //db.Pets.Remove(pet); //db.SaveChanges(); return RedirectToAction("Index"); }