예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Rule rule = db.Rules.Find(id);

            db.Rules.Remove(rule);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Detail,Link")] Rule rule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rule));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Detail,Link")] Rule rule)
        {
            if (ModelState.IsValid)
            {
                db.Rules.Add(rule);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rule));
        }
예제 #4
0
        // GET: Rules/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rule rule = db.Rules.Find(id);

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