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

            db.TANDAs.Remove(tANDA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "IdTanda,Nombre,Estado")] TANDA tANDA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tANDA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tANDA));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "IdTanda,Nombre,Estado")] TANDA tANDA)
        {
            if (ModelState.IsValid)
            {
                db.TANDAs.Add(tANDA);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tANDA));
        }
コード例 #4
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TANDA tANDA = db.TANDAs.Find(id);

            if (tANDA == null)
            {
                return(HttpNotFound());
            }
            return(View(tANDA));
        }
コード例 #5
0
 private void dataGridView1_DoubleClick(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow.Index != -1)
     {
         model.ID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value);
         using (RentaCarEntities db = new RentaCarEntities())
         {
             model             = db.TANDA.Where(x => x.ID == model.ID).FirstOrDefault();
             textBox1.Text     = model.DESCRIPCION;
             checkBox1.Checked = Convert.ToBoolean(model.ESTADO);
         }
         btnCrear.Text     = "Actualizar";
         btnBorrar.Enabled = true;
     }
 }