Beispiel #1
0
        // 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 Create([Bind(Include = "id_formato,formato1,estado")] Formato formato)
        {
            if (ModelState.IsValid)
            {
                db.Formatoes.Add(formato);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(formato));
        }
        public ActionResult Create([Bind(Include = "id_filtro,contenido,fecha,duracion,videos")] Filtro filtro)
        {
            if (ModelState.IsValid)
            {
                db.Filtroes.Add(filtro);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.videos = new SelectList(db.Videos, "id_video", "contenido", filtro.videos);
            return(View(filtro));
        }
        public ActionResult Create([Bind(Include = "id_casette,clave,estado,formato")] Casette casette)
        {
            if (ModelState.IsValid)
            {
                db.Casettes.Add(casette);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.formato = new SelectList(db.Formatoes, "id_formato", "formato1", casette.formato);
            return(View(casette));
        }
        public ActionResult Create([Bind(Include = "id_video,casette,contenido,fecha,duracion")] Video video)
        {
            if (ModelState.IsValid)
            {
                db.Videos.Add(video);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.casette = new SelectList(db.Casettes, "id_casette", "clave", video.casette);
            return(View(video));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "id_usuario,username,rol,password")] Usuario1 usuario1)
        {
            if (ModelState.IsValid)
            {
                db.Usuario1.Add(usuario1);
                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"));
        }