コード例 #1
0
        public void Setup()
        {
            GamingInfo _gi = new GamingInfo()
            {
                GameId       = 1, GameTitle = "Halo", GameDescription = "Good Game", ReleaseDate = DateTime.Today,
                GamePlatform = 1, GameCategory = 1, GamePrice = 10
            };

            _dbContext.GamingInfo.Add(_gi);
            _dbContext.SaveChanges();

            BusinessGames _bg = new BusinessGames()
            {
                BusinessId = 1, GameId = 1
            };

            _dbContext.BusinessGames.Add(_bg);
            _dbContext.SaveChanges();

            GamingPlatform _pl = new GamingPlatform()
            {
                PlatformId = 1, PlatformName = "SNES"
            };

            _dbContext.GamingPlatform.Add(_pl);
            _dbContext.SaveChanges();

            GamingCategory _ca = new GamingCategory()
            {
                CategoryId = 1, CategoryName = "Puzzle"
            };

            _dbContext.GamingCategory.Add(_ca);
            _dbContext.SaveChanges();
        }
コード例 #2
0
        public IActionResult ProductID([FromBody] GamingInfo id)
        {
            UserTempStorage.gameID = id.GameId;


            return(Ok(UserTempStorage.gameID));
        }
コード例 #3
0
        public async Task <IActionResult> EditGame([FromBody] GamingInfo inputValues)
        {
            inputValues.GameId = UserTempStorage.gameID;
            //gi = GamingInfo(inputValues.GameTitle, inputValues.GameDescription, inputValues.ReleaseDate, inputValues.GamePlatform, inputValues.GameCategory, inputValues.GamePrice);
            _context.GamingInfo.Update(inputValues);
            await _context.SaveChangesAsync();

            return(Ok(inputValues));
        }
コード例 #4
0
        public async Task <IActionResult> PostGame([FromBody] GamingInfo gamingInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.GamingInfo.Add(gamingInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGames", new { id = gamingInfo.GameId }, gamingInfo));
        }
コード例 #5
0
    // make sure only this script can stay on
    private void Awake()
    {
        if (gameInfoScript == null)
        {
            gameInfoScript = this;
            DontDestroyOnLoad(this);
        }
        else if (this != gameInfoScript)
        {
            Destroy(gameObject);
        }

        shop_props_size   = 9;
        shop_clothes_size = 9;
        shop_furni_size   = 9;

        eventNum       = 2;
        characterNum   = 2;
        achievementNum = 5;
    }
コード例 #6
0
        public async Task Check_PostGame_NewID()
        {
            // Arrange
            var        controller = new GameController(_dbContext);
            GamingInfo gamingInfo = new GamingInfo();

            gamingInfo.GameId          = 2;
            gamingInfo.GameTitle       = "Hello";
            gamingInfo.GameDescription = "Hello World";
            gamingInfo.ReleaseDate     = DateTime.Today;
            gamingInfo.GamePlatform    = 1;
            gamingInfo.GameCategory    = 2;
            gamingInfo.GamePrice       = 10;

            // Act
            IActionResult addGame = await controller.PostGame(gamingInfo);

            CreatedAtActionResult results = addGame as CreatedAtActionResult;

            string var = results.RouteValues["id"].ToString();

            // Assert
            Assert.AreEqual(var, "2");
        }