コード例 #1
0
        // 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"));
        }
コード例 #2
0
        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()));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        // 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));
        }
コード例 #5
0
        // 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));
        }