コード例 #1
0
        public IActionResult Delete(int id)
        {
            var model = speakerService.GetSpeakerById(id);

            speakerService.Delete(model);
            speakerService.Save();
            return(RedirectToAction("GetAllSpeakers", "Speakers"));
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
        public IActionResult DeletePost(int id)
        {
            var existingSpeaker = service.GetSpeakerById(id);

            if (existingSpeaker == null)
            {
                return(NotFound());
            }
            service.Delete(existingSpeaker);
            service.Save();
            return(RedirectToAction("List"));
        }
コード例 #4
0
        public IActionResult Delete(int id)
        {
            var existingSpeaker = service.GetSpeakerById(id);

            if (existingSpeaker != null)
            {
                service.Delete(existingSpeaker);
                service.Save();
            }

            return(RedirectToAction("List", "Speakers"));
        }
コード例 #5
0
        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());
        }
コード例 #6
0
        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));
        }
コード例 #7
0
 public IActionResult Delete([FromHeader] string eventId, [FromRoute] string speakerId)
 {
     _speakerService.Delete(eventId, speakerId);
     return(Ok());
 }