public IHttpActionResult Put([FromBody] GamesHistory gamesHistory) { try { using (var entities = new GreatWarriorEntities()) { var editGamesHistory = entities.GamesHistories.SingleOrDefault( f => f.Player_One_Email == gamesHistory.Player_One_Email && f.Player_Two_Email == gamesHistory.Player_Two_Email && f.Game_Date == gamesHistory.Game_Date); if (editGamesHistory == null) { return(Content(HttpStatusCode.NotFound, false)); } editGamesHistory.Player_One_Email = gamesHistory.Player_One_Email; editGamesHistory.Player_Two_Email = gamesHistory.Player_Two_Email; editGamesHistory.Game_Date = gamesHistory.Game_Date; editGamesHistory.Winner_Player = gamesHistory.Winner_Player; entities.SaveChanges(); return(Content(HttpStatusCode.OK, true)); } } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, ex)); } }
public IHttpActionResult Post([FromBody] GamesHistory gamesHistory) { try { using (var entities = new GreatWarriorEntities()) { entities.GamesHistories.Add(gamesHistory); entities.SaveChanges(); return(Content(HttpStatusCode.OK, true)); } } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, ex)); } }
public Boolean HasPlayed(string configFile) { return(GamesHistory != null && GamesHistory.Any(playedGame => playedGame.configFile.Equals(configFile))); }
public static void OpenGamesHistory() { GamesHistory gh = new GamesHistory(Client.GamesHistoryAdmin); }
//reset game settings and store history public void StoreHistory() { GamesHistory.Add(CurrGame); }