public void MapBaseballCardTesting_ModelEntity()
        {
            // Arrange
            var testCard = new Model.BaseballCard
            {
                Id         = 1,
                UserId     = 1,
                PlayerName = "Babe Ruth",
                Team       = "Yankees",
                Year       = 1914,
                Image      = "TestImageLink",
                Location   = "Binder"
            };

            // Act
            var entityCard = Mapper.Map(testCard);

            // Assert
            Assert.Equal(1, entityCard.Id);
            Assert.Equal(1, entityCard.UserId);
            Assert.Equal("Babe Ruth", entityCard.PlayerName);
            Assert.Equal("Yankees", entityCard.Team);
            Assert.Equal(1914, entityCard.Year);
            Assert.Equal("TestImageLink", entityCard.Image);
            Assert.Equal("Binder", entityCard.Location);
        }
示例#2
0
        public void PutBaseballCard(Lib.BaseballCard card)
        {
            var e_card = Mapper.Map(card);

            _context.BaseballCard.Update(e_card);
            _context.SaveChanges();
        }
示例#3
0
        // Update an existing Baseball card
        public IActionResult PutBaseballCard(Lib.BaseballCard card)
        {
            try
            {
                _repo.PutBaseballCard(card);

                return(NoContent());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
示例#4
0
 public static Entities.BaseballCard Map(Lib.BaseballCard c)
 {
     Entities.BaseballCard card = new Entities.BaseballCard()
     {
         Id         = c.Id,
         UserId     = c.UserId,
         PlayerName = c.PlayerName,
         Team       = c.Team,
         Year       = c.Year,
         Image      = c.Image,
         Location   = c.Location
     };
     return(card);
 }