Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TblCategorias tblCategorias = db.Categorias.Find(id);

            db.Categorias.Remove(tblCategorias);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "IdCategoria,Categoria,Descripcion")] TblCategorias tblCategorias)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblCategorias).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblCategorias));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "IdCategoria,Categoria,Descripcion")] TblCategorias tblCategorias)
        {
            if (ModelState.IsValid)
            {
                db.Categorias.Add(tblCategorias);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblCategorias));
        }
Example #4
0
        // GET: Categorias/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TblCategorias tblCategorias = db.Categorias.Find(id);

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