Example #1
0
        public int Insert(GameAddRequest model)
        {
            int id = 0;

            _dataProvider.ExecuteNonQuery(
                "dbo.Games_Insert",
                inputParamMapper : delegate(SqlParameterCollection paramCol)
            {
                SqlParameter param = new SqlParameter
                {
                    ParameterName = "@Id",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output
                };
                paramCol.Add(param);

                paramCol.AddWithValue("@Title", model.Title);
                paramCol.AddWithValue("@Plain", model.Plain);
                paramCol.AddWithValue("@CurrentLow", model.SalePrice);
                paramCol.AddWithValue("@ReleaseDate", model.ReleaseDate);
                paramCol.AddWithValue("@RetailPrice", model.RetailPrice);
            },
                returnParameters : delegate(SqlParameterCollection parameterCollection)
            {
                System.Int32.TryParse(parameterCollection["@Id"].Value.ToString(), out id);
            }
                );
            return(id);
        }
Example #2
0
        public async Task <IActionResult> AddUserGame([Required] string game, [FromBody] GameAddRequest gameAddRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            GenericResponse <BooleanResponse> response = await gameBusiness.AddUserGame(game, gameAddRequest.Username, gameAddRequest.ApiKey,
                                                                                        HttpContext.GetCurrentUserId());

            return(this.GetResultFromResponse(response));
        }