示例#1
0
        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)));
        }
示例#2
0
        public IActionResult Delete(int id)
        {
            var existingTalk = service.GetTalkById(id);

            if (existingTalk != null)
            {
                service.Delete(existingTalk);
                service.Save();
            }
            return(RedirectToAction("List", "Talk"));
        }
示例#3
0
        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"));
        }