// POST: Admin/TSql_Comment/Delete/5 public async Task <ActionResult> DeleteConfirmed(int id) { TSql_Comment tSql_Comment = await db.TSql_Comment.FindAsync(id); db.TSql_Comment.Remove(tSql_Comment); await db.SaveChangesAsync(); Session["countCmt"] = Int32.Parse(Session["countCmt"].ToString()) - 1; return(RedirectToAction("Index")); }
public ActionResult PostComment(TSql_Comment cmt) { TSql_Informations info = (TSql_Informations)Session["flag"]; cmt.IDInfo = info.IDInfo; cmt.DatePost = DateTime.Now; cmt.IDFilm = Int32.Parse(Session["tmpFilm"].ToString()); db.TSql_Comment.Add(cmt); db.SaveChanges(); return(Redirect(Request.UrlReferrer.ToString())); }
public async Task <ActionResult> Edit([Bind(Include = "IDComment,IDFilm,IDInfo,Comment,DatePost")] TSql_Comment tSql_Comment) { if (ModelState.IsValid) { db.Entry(tSql_Comment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.IDFilm = new SelectList(db.TSql_Films, "IDFilm", "FilmName", tSql_Comment.IDFilm); ViewBag.IDInfo = new SelectList(db.TSql_Informations, "IDInfo", "DisplayName", tSql_Comment.IDInfo); return(View(tSql_Comment)); }
// GET: Admin/TSql_Comment/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TSql_Comment tSql_Comment = await db.TSql_Comment.FindAsync(id); if (tSql_Comment == null) { return(HttpNotFound()); } return(View(tSql_Comment)); }
// GET: Admin/TSql_Comment/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TSql_Comment tSql_Comment = await db.TSql_Comment.FindAsync(id); if (tSql_Comment == null) { return(HttpNotFound()); } ViewBag.IDFilm = new SelectList(db.TSql_Films, "IDFilm", "FilmName", tSql_Comment.IDFilm); ViewBag.IDInfo = new SelectList(db.TSql_Informations, "IDInfo", "DisplayName", tSql_Comment.IDInfo); return(View(tSql_Comment)); }