public IActionResult OnPost() { TblPerson = _personRepo.DeletePerson(TblPerson.PersonId); if (TblPerson != null) { return(RedirectToPage("Index")); } else { return(NotFound()); } }
public ActionResult Delete(int id) { try { _personRepo.DeletePerson(id); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(new { success = false, message = "Error in deletion" + "\n" + e.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeletePerson(int id) { var personModelFromRepo = _repository.GetPersonById(id); if (personModelFromRepo == null) { return(NotFound()); } _repository.DeletePerson(personModelFromRepo); _repository.SaveChanges(); return(NoContent()); }
public ActionResult DeletePerson(int id) { // cautam persoana Person prs = _personRepo.GetPersonById(id); if (prs == null) { return(NotFound()); } _personRepo.DeletePerson(prs); _personRepo.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeletePerson(Guid Id) { var Person = _PersonRepo.GetPersonById(Id); if (Person == null) { return(NotFound()); } _PersonRepo.DeletePerson(Person); _PersonRepo.SaveChanges(); return(NoContent()); }