コード例 #1
0
 public ActionResult <Speaker> Delete(int id)
 {
     try
     {
         return(Ok(_speakerService.DeleteSpeaker(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
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)));
        }