public void InsertShouldReturnInsertId()
        {
            //BoardGamesController boardGames = new BoardGamesController();
            System.Data.Entity.Database.SetInitializer(new BoardGameDatabaseInitializer());
            BoardGameContext context = new BoardGameContext();
            //context.Database.Initialize(true);
            IBoardGameRepository _boardGame = new BoardGameRepository(context);

            BoardGame boardGame = new BoardGame()
            {
                Id = 0,
                Name = "Unit Test 01",
                Year = 2015,
                Category = "Testing Category",
                Description = "Description test.",
                Players = "1-10",
                Image = ""
            };

            //var request = new IHttpActionResult();

            //request = boardGames.PostBoardGame(boardGame);

            //IHttpActionResult

            //int id = _boardGame.InsertBoardGame(boardGame);
            //int id = boardGames.PostBoardGame(boardGame);
            //Assert.AreNotEqual(0, id);
        }
        public void GetShouldReturnBoardGames()
        {
            BoardGamesController boardGames = new BoardGamesController();

            BoardGame boardGame = new BoardGame()
            {
                Id = 0,
                Name = "Unit Test 01",
                Year = 2015,
                Category = "Testing Category",
                Description = "Description test.",
                Players = "1-10",
                Image = ""
            };

            boardGames.PostBoardGame(boardGame);
        }
        public IHttpActionResult PutBoardGame(int id, BoardGame boardGame)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != boardGame.Id)
            {
                return BadRequest();
            }

            _boardGame.UpdateBoardGame(boardGame);

            try
            {
                _boardGame.Save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_boardGame.BoardGameExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostBoardGame(BoardGame boardGame)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _boardGame.InsertBoardGame(boardGame);
            _boardGame.Save();

            return CreatedAtRoute("DefaultApi", new { id = boardGame.Id }, boardGame);
        }
 public void UpdateBoardGame(BoardGame boardGame)
 {
     context.Entry(boardGame).State = System.Data.Entity.EntityState.Modified;
 }
 public int InsertBoardGame(BoardGame boardGame)
 {
     BoardGame newBoardGame = context.BoardGames.Add(boardGame);
     return newBoardGame.Id;
 }