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(); }
public IActionResult ProductID([FromBody] GamingInfo id) { UserTempStorage.gameID = id.GameId; return(Ok(UserTempStorage.gameID)); }
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)); }
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)); }
// 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; }
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"); }