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

            db.Daylilies.Remove(daylily);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Name,Color,Height,BloomSize")] Daylily daylily)
 {
     if (ModelState.IsValid)
     {
         db.Entry(daylily).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(daylily));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ID,Name,Color,Height,BloomSize")] Daylily daylily)
        {
            if (ModelState.IsValid)
            {
                db.Daylilies.Add(daylily);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

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

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