public async Task <IActionResult> PutMovie(int id, Movie movie) { if (id != movie.Id) { return(BadRequest()); } _context.Entry(movie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutReview([FromRoute] int id, [FromBody] Review review) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != review.ReviewID) { return(BadRequest()); } _context.Entry(review).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReviewExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public TEntity Update(TEntity obj) { var resut = table.Attach(obj); _context.Entry(obj).State = EntityState.Modified; return(resut.Entity); }
public ActionResult Edit([Bind(Include = "Id,Title,ReleaseDate,Genre,Price")] Movie movie) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(movie)); }
public ActionResult Edit([Bind(Include = "ID,Title,Genre,Price,ReleaseDate,Rating")] Film film) { if (ModelState.IsValid) { db.Entry(film).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(film)); }
public ActionResult Edit([Bind(Include = "ProductID,Name,Price,Active")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public void Update(TEntity obj) { table.Attach(obj); _context.Entry(obj).State = EntityState.Modified; }