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); }
public void PutBaseballCard(Lib.BaseballCard card) { var e_card = Mapper.Map(card); _context.BaseballCard.Update(e_card); _context.SaveChanges(); }
// Update an existing Baseball card public IActionResult PutBaseballCard(Lib.BaseballCard card) { try { _repo.PutBaseballCard(card); return(NoContent()); } catch (Exception) { return(BadRequest()); } }
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); }