public ActionResult DeleteConfirmed(int id) { ArticlesComment articlesComment = db.ArticlesComments.Find(id); db.ArticlesComments.Remove(articlesComment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id, int ids) { ArticlesComment articlesComment = db.ArticlesComments.Find(id); db.ArticlesComments.Remove(articlesComment); db.SaveChanges(); return(RedirectToAction("ViewDetails", "Post", new { id = ids })); }
public ActionResult Edit([Bind(Include = "CommentId,Comments,ThisDateTime,ArticleId,Rating")] ArticlesComment articlesComment) { if (ModelState.IsValid) { db.Entry(articlesComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(articlesComment)); }
public ActionResult Create([Bind(Include = "CommentId,Comments,ThisDateTime,ArticleId,Rating")] ArticlesComment articlesComment) { if (ModelState.IsValid) { db.ArticlesComments.Add(articlesComment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(articlesComment)); }
public ActionResult Edit([Bind(Include = "CommentID,Comments,ThisDateTime,ProviderID,Rating")] ArticlesComment articlesComment) { if (ModelState.IsValid) { db.Entry(articlesComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProviderID = new SelectList(db.Providers, "ProviderID", "ProviderName", articlesComment.ProviderID); return(View(articlesComment)); }
public ActionResult Edit([Bind(Include = "CommentId,Comment,CommentOn,CommentBy,MagazineID")] ArticlesComment articlesComment) { if (ModelState.IsValid) { db.Entry(articlesComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MagazineID = new SelectList(db.Magazines, "MagazineID", "MagazineName", articlesComment.MagazineID); return(View(articlesComment)); }
public ActionResult Create([Bind(Include = "CommentId,Comment,CommentOn,CommentBy,MagazineID")] ArticlesComment articlesComment) { if (ModelState.IsValid) { db.ArticlesComments.Add(articlesComment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MagazineID = new SelectList(db.Magazines, "MagazineID", "MagazineName", articlesComment.MagazineID); return(View(articlesComment)); }
// GET: ArticlesComments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArticlesComment articlesComment = db.ArticlesComments.Find(id); if (articlesComment == null) { return(HttpNotFound()); } return(View(articlesComment)); }
// GET: ArticlesComments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArticlesComment articlesComment = db.ArticlesComments.Find(id); if (articlesComment == null) { return(HttpNotFound()); } ViewBag.ProviderID = new SelectList(db.Providers, "ProviderID", "ProviderName", articlesComment.ProviderID); return(View(articlesComment)); }
public ActionResult Add(FormCollection form) { var comment = form["Comment"].ToString(); var articleId = int.Parse(form["ArticleId"]); var rating = int.Parse(form["Rating"]); ArticlesComment artComment = new ArticlesComment() { ArticleId = articleId, Comments = comment, Rating = rating, ThisDateTime = DateTime.Now }; db.ArticlesComments.Add(artComment); db.SaveChanges(); return(RedirectToAction("Details", "Articles", new { id = articleId })); }
public ActionResult Add(FormCollection form) { var comment = form["Comment"].ToString(); var articleId = int.Parse(form["ArticleId"]); var rating = int.Parse(form["Rating"]); var users = System.Web.HttpContext.Current.User.Identity.GetUserName(); if (User.IsInRole("Admin")) { ArticlesComment artComment = new ArticlesComment() { ArticleId = articleId, Comments = comment, Rating = rating, ThisDateTime = DateTime.Now, User_n = users, Com_mark = false }; db.ArticlesComments.Add(artComment); db.SaveChanges(); } else { ArticlesComment artComment1 = new ArticlesComment() { ArticleId = articleId, Comments = comment, Rating = rating, ThisDateTime = DateTime.Now, User_n = users }; db.ArticlesComments.Add(artComment1); db.SaveChanges(); } return(RedirectToAction("ViewDetails", "Post", new { id = articleId })); }