public void deletePlayer() { using (var db = new bowlingEntities()) { this.game.players.Remove(this); try { db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } } }
public void addPlayer(player p) { using (var db = new bowlingEntities()) { this.game.players.Add(p); try { db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } } }
public void cancelGame(game g) { using (var db = new bowlingEntities()) { try { game game = db.games.Find(g.Id); game.State = "canceled"; db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } } }
public void addPlayer(game g, player p) { using (var db = new bowlingEntities()) { try { game game = db.games.Find(g.Id); game.players.Add(p); db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } } }
public game createGame() { bowlingEntities db = new bowlingEntities(); game g = new game(); g.State = "pending"; try { db.games.Add(g); db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } return g; }
public void assignToLane() { using (var db = new bowlingEntities()) { lane lane = (from l in db.lanes where l.State == "available" select l).SingleOrDefault(); db.games.Attach(this); db.Entry(this).State = EntityState.Modified; if (lane != null) { this.Lane_id = lane.Id; } else { this.assignReservation(); } db.SaveChanges(); } }
public game createGame() { using (var db = new bowlingEntities()) { db.players.Attach(this); db.Entry(this).State = EntityState.Modified; game game = new game(); game.players.Add(this); try { db.games.Add(game); db.SaveChanges(); } catch (Exception e) { throw new Exception("Error", e); } return game; } }