public IActionResult Delete(int id) { var model = speakerService.GetSpeakerById(id); speakerService.Delete(model); speakerService.Save(); return(RedirectToAction("GetAllSpeakers", "Speakers")); }
public ActionResult Delete(int id, SpeakersViewModel model) { Speakers speakerToDelete = new Speakers(); speakerToDelete = speakerService.GetSpeakerById(id); model.InjectFrom(speakerToDelete); speakerService.Delete(speakerToDelete); speakerService.Save(); return(RedirectToAction(nameof(Index))); }
public IActionResult DeletePost(int id) { var existingSpeaker = service.GetSpeakerById(id); if (existingSpeaker == null) { return(NotFound()); } service.Delete(existingSpeaker); service.Save(); return(RedirectToAction("List")); }
public IActionResult Delete(int id) { var existingSpeaker = service.GetSpeakerById(id); if (existingSpeaker != null) { service.Delete(existingSpeaker); service.Save(); } return(RedirectToAction("List", "Speakers")); }
public ActionResult DeleteSpeaker(int id) { var speaker = service.GetSpeakerById(id); if (speaker == null) { return(NotFound($"The speaker with Id: {id} does not exist")); } service.Delete(speaker); service.Save(); return(NoContent()); }
public IActionResult Delete(int id) { var existingSpeaker = service.GetSpeakerById(id); if (existingSpeaker != null) { service.Delete(existingSpeaker); service.Save(); } IEnumerable <Speaker> allSpeakers = service.GetAllSpeakers(); var speakerDtos = mapper.Map <IEnumerable <SpeakerDto> >(allSpeakers); return(View("List", speakerDtos)); }
public IActionResult Delete([FromHeader] string eventId, [FromRoute] string speakerId) { _speakerService.Delete(eventId, speakerId); return(Ok()); }