public ActionResult DeleteConfirmed(int id)
 {
     using (CommentsEntities db = new CommentsEntities())
     {
         Comment comment = db.Comments.Find(id);
         db.Comments.Remove(comment);
         db.SaveChanges();
         return(RedirectToAction("View", new { id = comment.Image_ID }));
     }
 }
 public ActionResult AddC(Comment commentModel)
 {
     using (CommentsEntities comment = new CommentsEntities())
     {
         commentModel.Username = Session["fullName"].ToString();
         comment.Comments.Add(commentModel);
         comment.SaveChanges();
     }
     ModelState.Clear();
     ViewBag.SuccessMessage = "Added successful";
     return(RedirectToAction("View", "Images", new { id = commentModel.Image_ID }));
     //return View();
 }
 public ActionResult Edit([Bind(Include = "Comment_ID,Text,Username,Image_ID")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         using (CommentsEntities db = new CommentsEntities())
         {
             db.Entry(comment).State = EntityState.Modified;
             db.SaveChanges();
         }
         //return View(comment);
         return(RedirectToAction("View", new { id = comment.Image_ID }));
     }
     return(View(comment));
 }