public async Task <IActionResult> PutCollection(int id, Collection collection) { if (id != collection.midex) { return(BadRequest()); } _context.Entry(collection).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CollectionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCard([FromRoute] int id, [FromBody] Card card) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != card.CardId) { return(BadRequest()); } _context.Entry(card).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutActor(int id, Actor actor) { if (id != actor.Id) { return(BadRequest()); } _context.Entry(actor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IHttpActionResult> PutPiece(int id, Piece piece) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != piece.PieceId) { return(BadRequest()); } db.Entry(piece).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PieceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Name,Designer,PlayTime,CoreMechanic,MinPlayers,MaxPlayers,Weight,Rating")] Game game) { if (ModelState.IsValid) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(game)); }