public ActionResult DeleteComment(DeleteCommentBindingModel dcbm) { this.service.DeleteComment(dcbm); var commentsVM = this.service.GetCommentsVms(dcbm.VideoYoutubeId); return(this.PartialView("~/Views/Shared/Partials/CommentsPartial.cshtml", commentsVM)); }
public void DeleteComment(DeleteCommentBindingModel dcbm) { var comment = this.data.Comments.All().FirstOrDefault(x => x.Id == dcbm.Id); this.data.Comments.Remove(comment); this.data.SaveChanges(); }
public ActionResult DeleteComment(DeleteCommentBindingModel model) { if (ModelState.IsValid) { //FlashMessage.Confirmation("Are you shore you wont to delete this comment?"); this.service.DeleteComment(model.Id); return(RedirectToAction("Details", "Snippet", new { id = model.SnippetId })); } return(RedirectToAction("DeleteComment", new { id = model.Id })); }