/// <summary> /// Save a Game to the Database /// </summary> /// <param name="game">Gameobject to Save</param> /// <returns>1 if successfull, otherwise 0</returns> public int SaveGame(FluffTailRanking.BusinessLayer.BusinessObjects.Game game) { try { using (KickerEntities context = new KickerEntities()) { FluffTailRanking.BusinessLayer.Persistence.Game current = new FluffTailRanking.BusinessLayer.Persistence.Game() { date = DateTime.Now, teamone = game.Team1.ID, teamtwo = game.Team2.ID, winner = game.Winner.ID }; //TODO: Update Player wins / losts on save context.Game.Add(current); context.SaveChanges(); } return(1); } catch (Exception ex) { return(0); } }
/// <summary> /// Save a Game to the Database /// </summary> /// <param name="game">Gameobject to Save</param> /// <returns>1 if successfull, otherwise 0</returns> public int SaveGame(FluffTailRanking.BusinessLayer.BusinessObjects.Game game) { try { using (KickerEntities context = new KickerEntities()) { FluffTailRanking.BusinessLayer.Persistence.Game current = new FluffTailRanking.BusinessLayer.Persistence.Game() { date = DateTime.Now, teamone = game.Team1.ID, teamtwo = game.Team2.ID, winner = game.Winner.ID }; //TODO: Update Player wins / losts on save context.Game.Add(current); context.SaveChanges(); } return 1; } catch (Exception ex) { return 0; } }