public ActionResult DeleteConfirmed(int id) { if (repo.Delete(id)) { return(RedirectToAction("Index")); } return(HttpNotFound()); }
public bool RemovePerson(int id) { Person per = _personRepo.Read(id); if (per == null) { return(false); } else { return(_personRepo.Delete(per)); } }
public async Task <ActionResult> DeletePerson(string name) { try { var personToDelete = await _personRepo.GetPersonByName(name); if (personToDelete == null) { return(NotFound($"There is no person with that name in the database")); } _personRepo.Delete(personToDelete); if (await _personRepo.Save()) { return(Ok($"You deleted the person: {personToDelete.Name.ToString()} from the database")); } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure:{e.Message}")); } return(BadRequest()); }
void IPersonManager.Delete(int id) { _personRepo.Delete(id); }
public void Delete(int?id) { personRepo.Delete(id); }
public IActionResult DeleteConfirmed(int id) { _people.Delete(id); return(RedirectToAction("Index")); }