// PUT: odata/Videos(5)
        public IHttpActionResult Put([FromODataUri] int key, Video video)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (key != video.Id)
            {
                return(BadRequest());
            }

            db.Entry(video).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VideoExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(video));
        }
 public ActionResult Edit([Bind(Include = "id_formato,formato1,estado")] Formato formato)
 {
     if (ModelState.IsValid)
     {
         db.Entry(formato).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(formato));
 }
 public ActionResult Edit([Bind(Include = "id_filtro,contenido,fecha,duracion,videos")] Filtro filtro)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filtro).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.videos = new SelectList(db.Videos, "id_video", "contenido", filtro.videos);
     return(View(filtro));
 }
 public ActionResult Edit([Bind(Include = "id_casette,clave,estado,formato")] Casette casette)
 {
     if (ModelState.IsValid)
     {
         db.Entry(casette).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.formato = new SelectList(db.Formatoes, "id_formato", "formato1", casette.formato);
     return(View(casette));
 }
 public ActionResult Edit([Bind(Include = "id_video,casette,contenido,fecha,duracion")] Video video)
 {
     if (ModelState.IsValid)
     {
         db.Entry(video).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.casette = new SelectList(db.Casettes, "id_casette", "clave", video.casette);
     return(View(video));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "id_usuario,username,rol,password")] Usuario1 usuario1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usuario1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.rol = new SelectList(db.Rols, "id_rol", "nombre", usuario1.rol);
     return(View(usuario1));
 }
        public ActionResult Del(int id)
        {
            MyOrder target = new MyOrder()
            {
                Id = id
            };
            DbEntityEntry entry = db.Entry(target);

            entry.State = System.Data.Entity.EntityState.Deleted;

            db.SaveChanges();
            return(Json("OK"));
        }