Beispiel #1
0
        // GET: Speakers/Details/5
        public ActionResult Details(int id)
        {
            var speakerDetails      = speakerService.GetById(id);
            SpeakersViewModel model = new SpeakersViewModel();

            model.InjectFrom(speakerDetails);
            return(View(model));
        }
        // GET: Speakers/Edit/5
        public ActionResult Edit(int id)
        {
            var speaker             = speakerService.GetSpeakerById(id);
            SpeakersViewModel model = new SpeakersViewModel();

            model.InjectFrom(speaker);
            return(View(model));
        }
        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)));
        }
Beispiel #4
0
        public ActionResult Delete(int id, SpeakersViewModel model)
        {
            Speakers deleteSpeaker = new Speakers();

            deleteSpeaker = speakerService.GetById(id);

            model.InjectFrom(deleteSpeaker);

            speakerService.DeleteSpeaker(deleteSpeaker);

            return(RedirectToAction(nameof(Index)));
        }