public async Task <IActionResult> PutMovie([FromRoute] int id, [FromBody] Movie movie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != movie.MovieId) { return(BadRequest()); } _context.Entry(movie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(Studio studio) { if (ModelState.IsValid) { db.Entry(studio).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studio)); }
public ActionResult Edit(Actress actress) { if (ModelState.IsValid) { db.Entry(actress).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actress)); }
public ActionResult Edit(Movie movie) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ActorId = new SelectList(db.Actors, "Id", "Name", movie.ActorId); ViewBag.ActressId = new SelectList(db.Actresses, "Id", "Name", movie.ActressId); ViewBag.DirectorId = new SelectList(db.Directors, "Id", "Name", movie.DirectorId); ViewBag.StudioId = new SelectList(db.Studios, "Id", "Name", movie.StudioId); return(View(movie)); }