public IHttpActionResult Get(string gameid) { string message = ""; bool flag = false; GamePostModel data = new GamePostModel(); try { object infoObject; Request.Properties.TryGetValue(Constants.IdentificationInfo, out infoObject); DBServerIdentification identificationInfo = (DBServerIdentification)infoObject; DataSQL objSQL = new DataSQL(identificationInfo); GamesLogic gl = new GamesLogic(objSQL); data = gl.getGames(gameid); message = gl.errorMessage; } catch (Exception ex) { message = ex.Message; FileLogger.AppendLog("GamesController >> ", LogType.Error, "GET", ex.Message); } if (message.Length == 0) { return(Ok(data)); } else { return(BadRequest(message)); } }
public IHttpActionResult Post([FromBody] GamePostModel value) { string message = "New game added"; bool flag = false; try { object infoObject; Request.Properties.TryGetValue(Constants.IdentificationInfo, out infoObject); DBServerIdentification identificationInfo = (DBServerIdentification)infoObject; DataSQL objSQL = new DataSQL(identificationInfo); GamesLogic gl = new GamesLogic(objSQL); flag = gl.addNewGame(value); message = gl.errorMessage; } catch (Exception ex) { message = ex.Message; FileLogger.AppendLog("GamesController >> ", LogType.Error, "POST", ex.Message); } if (flag) { return(Ok(message)); } else { return(BadRequest(message)); } }
public GamePostModel getGames(string gameid) { GamePostModel data = new GamePostModel(); errorMessage = string.Empty; try { data = objSQL.getGames(gameid); } catch (Exception ex) { errorMessage = ex.Message; FileLogger.AppendLog("GamesLogic ", LogType.Error, "getPendingApprovals >> ", ex.Message); } return(data); }
public bool addNewGame(GamePostModel game) { bool flag = false; errorMessage = string.Empty; try { flag = objSQL.addNewGame(game); errorMessage = objSQL.errorMessage; } catch (Exception ex) { flag = false; errorMessage = ex.Message; FileLogger.AppendLog("GamesLogic ", LogType.Error, "addNewGame >> ", ex.Message); } return(flag); }