public ActionResult Delete(int id, TalksViewModel model) { Talks talkToDelete = new Talks(); talkToDelete = talkService.GetTalkById(id); model.InjectFrom(talkToDelete); talkService.Delete(talkToDelete); talkService.Save(); return(RedirectToAction(nameof(Index))); }
public IActionResult Delete(int id) { var existingTalk = service.GetTalkById(id); if (existingTalk != null) { service.Delete(existingTalk); service.Save(); } return(RedirectToAction("List", "Talk")); }
public ActionResult Delete(int id) { var talk = service.getTalkById(id); if (talk == null) { return(NotFound($"The talk with Id: {id} does not exist")); } service.Delete(talk); service.Save(); return(NoContent()); }
public IActionResult DeletePost(int id) { var existingTalk = service.getTalkById(id); if (existingTalk == null) { return(NotFound()); } service.Delete(existingTalk); service.Save(); return(RedirectToAction("List")); }