public async Task <IHttpActionResult> PutVideoGame(int id, VideoGame videoGame) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != videoGame.Id) { return(BadRequest()); } db.Entry(videoGame).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoGameExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ResponseStatusMessages Edit(VideoGame videoGame) { try { _db.Entry(videoGame).State = EntityState.Modified; Save(); return(ResponseStatusMessages.Done); } catch { return(ResponseStatusMessages.ItemNotFound); } }