Ejemplo n.º 1
0
        // GET: FBPost
        public ActionResult Index()
        {
            FBCommentsModel fBCommentsModel = new FBCommentsModel();

            fBCommentsModel.Posts  = db.FBPosts.ToList();
            fBCommentsModel.FBPost = new FBPost();
            return(View(fBCommentsModel));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int?id)
        {
            List <Comment> comments = db.Comments.Where(a => a.FbPostsId == id).ToList();

            db.Comments.RemoveRange(comments);
            var post = db.FBPosts.SingleOrDefault(a => a.Id == id);

            db.FBPosts.Remove(post);

            db.SaveChanges();

            FBCommentsModel fBCommentsModel = new FBCommentsModel();

            fBCommentsModel.Posts  = db.FBPosts.ToList();
            fBCommentsModel.FBPost = new FBPost();
            return(View("Index", fBCommentsModel));
        }