예제 #1
0
 public ActionResult Edit([Bind(Include = "CODESTILO,COLOR,DESCRIPCION")] ESTILO eSTILO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eSTILO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eSTILO));
 }
예제 #2
0
        public ActionResult Create([Bind(Include = "CODESTILO,COLOR,DESCRIPCION")] ESTILO eSTILO)
        {
            if (ModelState.IsValid)
            {
                db.ESTILO.Add(eSTILO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eSTILO));
        }
예제 #3
0
        // GET: estilo/Edit/5
        public ActionResult Edit(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ESTILO eSTILO = db.ESTILO.Find(id);

            if (eSTILO == null)
            {
                return(HttpNotFound());
            }
            return(View(eSTILO));
        }
예제 #4
0
        // GET: estilo/Delete/5
        public ActionResult Delete(decimal id, bool canDelete = true)
        {
            ViewBag.canDelete = canDelete;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ESTILO eSTILO = db.ESTILO.Find(id);

            if (eSTILO == null)
            {
                return(HttpNotFound());
            }
            return(View(eSTILO));
        }
예제 #5
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            ESTILO eSTILO = db.ESTILO.Find(id);

            db.ESTILO.Remove(eSTILO);
            try
            {
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (DbUpdateException)
            {
                Dispose(true);
                return(RedirectToAction("Delete", new { id = id, canDelete = false }));
            }
        }