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

            db.Database.ExecuteSqlCommand("DELETE FROM tblArticulo WHERE idGenero = @idGenero",
                                          new SqlParameter("idGenero", tblGenero.idGenero)
                                          );
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "idGenero,Genero")] tblGenero tblGenero)
 {
     if (ModelState.IsValid)
     {
         db.Database.ExecuteSqlCommand("UPDATE tblEstado SET  idGenero = @idGenero, Genero = @Genero",
                                       new SqlParameter("Genero", tblGenero.Genero)
                                       );
         return(RedirectToAction("Index"));
     }
     return(View(tblGenero));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "idGenero,Genero")] tblGenero tblGenero)
        {
            if (ModelState.IsValid)
            {
                db.Database.ExecuteSqlCommand("INSERT into tblGenero VALUES (@Genero)",

                                              new SqlParameter("Genero", tblGenero.Genero)
                                              );
                return(RedirectToAction("Index"));
            }

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

            if (tblGenero == null)
            {
                return(HttpNotFound());
            }
            return(View(tblGenero));
        }
コード例 #5
0
 public GeneroItem(tblGenero Genero)
 {
     this.Genero = Genero;
 }