public void deleteContact(string firstName)
 {
     if (!contactRepo.GetPersonByName(firstName))
     {
         Console.WriteLine("Person  Not Exist");
     }
     else
     {
         contactRepo.DeleteContact(firstName);
     }
 }
        public ActionResult DeleteContact([FromQuery] string Dni)
        {
            //Check if patient exists
            var patientFromRepo = _repository.ExistContactedPerson(Dni);

            if (patientFromRepo == null)
            {
                return(NotFound());
            }

            _repository.DeleteContact(patientFromRepo);
            _repository.SaveChanges();

            return(NoContent());
        }
 public ActionResult DeleteContact(int id)
 {
     try
     {
         ContactRepo ContactRepoObj = new ContactRepo();
         if (ContactRepoObj.DeleteContact(id))
         {
             ViewBag.AlertMsg = "Employee details deleted successfully";
         }
         return(RedirectToAction("GetAllContactDetails"));
     }
     catch
     {
         return(RedirectToAction("GetAllContactDetails"));
     }
 }
Esempio n. 4
0
 public ActionResult DeleteMessage(int id)
 {
     cp.DeleteContact(id);
     return(RedirectToAction("ShowMessage"));
 }