Ejemplo n.º 1
0
 public void Delete([FromBody] TokenParams token, Int64 gameId)
 {
     try
     {
         using (GamesManagementServiceClient gmsClient = new GamesManagementServiceClient())
         {
             Game game = new Game()
             {
                 GameId = gameId
             };
             gmsClient.DeleteGame(game, token.Token);
         }
     }
     catch (FaultException <GamesManagementFault> ex)
     {
         if (ex.Detail.FaultType == GamesManagementFault.GamesManagementFaultType.TokenExpired)
         {
             throw new HttpResponseException(SetHttpErrorMsg("Token Expired. Re-login.", HttpStatusCode.Unauthorized));
         }
         else if (ex.Detail.FaultType == GamesManagementFault.GamesManagementFaultType.InvalidSignature)
         {
             throw new HttpResponseException(SetHttpErrorMsg("Invalid Token Signature.", HttpStatusCode.Unauthorized));
         }
         else
         {
             throw new HttpResponseException(SetHttpErrorMsg("Internal Server Error.", HttpStatusCode.InternalServerError));
         }
     }
 }
Ejemplo n.º 2
0
 public static void DeleteGame(string game_id)
 {
     try
     {
         using (GamesManagementServiceClient gmsClient = new GamesManagementServiceClient())
         {
             HttpCookie token_cookie = HttpContext.Current.Request.Cookies.Get("token_cookie");
             Game       game         = new Game()
             {
                 GameId = Int64.Parse(game_id)
             };
             gmsClient.DeleteGame(game, token_cookie.Value);
             HttpContext.Current.Response.Redirect("Home.aspx");
         }
     }
     catch (Exception)
     {
         //
     }
 }