Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        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));
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }