コード例 #1
0
ファイル: TablaController.cs プロジェクト: kuchiky001/entity
        public ActionResult Editar(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (masterEntities1 db = new masterEntities1())
                    {
                        var oTabla = db.tabla.Find(model.Id);
                        oTabla.correo           = model.Correo;
                        oTabla.fecha_nacimiento = model.Fecha_Nacimiento;
                        oTabla.nombre           = model.Nombre;

                        db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }

                    return(Redirect("~/Tabla/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Title,Url,Platform,Score,Genre,Editors_choice,Release_year,ID")] Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(game));
 }