Exemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "ActionID,Title")] Action action)
 {
     if (ModelState.IsValid)
     {
         db.Entry(action).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(action));
 }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "ActionID,Title")] Action action1)
        {
            if (ModelState.IsValid)
            {
                db.Action.Add(action1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(action1));
        }
Exemplo n.º 3
0
        // GET: Admin/Actions/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Action action = db.Action.Find(id);

            if (action == null)
            {
                return(HttpNotFound());
            }
            return(View(action));
        }
Exemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Action action = db.Action.Find(id);

            //db.Action.Remove(action);
            //db.SaveChanges();
            //return RedirectToAction("Index");


            try
            {
                db.Action.Remove(action);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                ViewBag.Error = true;
                return(View("Delete"));
            }
        }