Exemplo n.º 1
0
 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));
     }
 }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 public Boolean HasPlayed(string configFile)
 {
     return(GamesHistory != null && GamesHistory.Any(playedGame => playedGame.configFile.Equals(configFile)));
 }
Exemplo n.º 4
0
 public static void OpenGamesHistory()
 {
     GamesHistory gh = new GamesHistory(Client.GamesHistoryAdmin);
 }
Exemplo n.º 5
0
 //reset game settings and store history
 public void StoreHistory()
 {
     GamesHistory.Add(CurrGame);
 }