public async Task <IActionResult> PutMovies([FromRoute] int id, [FromBody] Movie movie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != movie.FilmId)
            {
                return(BadRequest());
            }

            _context.Entry(movie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MoviesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ID,Nazwa,Logo")] StudioModels ownerModelUpdated)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownerModelUpdated).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ownerModelUpdated));
 }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "ID,Nazwa,Data_dolaczenia")] UzytkownicyModels ownerModelUpdated)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownerModelUpdated).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ownerModelUpdated));
 }
 public ActionResult Edit([Bind(Include = "FilmID, UzytkownicyID")] WypozyczeniaModels ownerModelUpdated)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownerModelUpdated).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Moje_filmy"));
     }
     return(View(ownerModelUpdated));
 }
        public ActionResult Edit([Bind(Include = "ID,Tytul,Dlugosc,Plakat,Opis,GatunekID,StudioID")] FilmyModels ownerModelUpdated)
        {
            if (ModelState.IsValid)
            {
                db.Entry(ownerModelUpdated).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.GatunekID = new SelectList(db.Gatunek, "ID", "Nazwa", ownerModelUpdated.GatunekID);
            ViewBag.StudioID  = new SelectList(db.Studio, "ID", "Nazwa", ownerModelUpdated.StudioID);

            return(View(ownerModelUpdated));
        }