コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Barcomments barcomments = db.Barcomments.Find(id);

            db.Barcomments.Remove(barcomments);
            db.SaveChanges();
            return(RedirectToAction("Index", "NightLives"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,BarName,Comment,PostDate")] Barcomments barcomments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(barcomments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "NightLives"));
     }
     return(View(barcomments));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Name,BarName,Comment,PostDate")] Barcomments barcomments)
        {
            if (ModelState.IsValid)
            {
                barcomments.PostDate = DateTime.Today;
                db.Barcomments.Add(barcomments);
                db.SaveChanges();
                return(RedirectToAction("Index", "NightLives"));
            }

            return(View(barcomments));
        }
コード例 #4
0
        // GET: Barcomments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Barcomments barcomments = db.Barcomments.Find(id);

            if (barcomments == null)
            {
                return(HttpNotFound());
            }
            return(View(barcomments));
        }