CardShop.Controllers.BaseballCardController.Delete C# (CSharp) Méthode

Delete() public méthode

public Delete ( int id ) : System.Web.Mvc.ActionResult
id int
Résultat System.Web.Mvc.ActionResult
        public ActionResult Delete(int id = 0)
        {
            BaseballCard baseballcard = baseballCardService.GetBaseballCard(id);
            if (baseballcard == null)
            {
                return HttpNotFound();
            }
            return View(baseballcard);
        }

Usage Example

        public void TestDeleteGetValidBaseballCard()
        {
            BaseballCardController controller = new BaseballCardController(mockCardRepository.Object);
            int baseballCardId = 1;

            ViewResult result = controller.Delete(baseballCardId) as ViewResult;
            BaseballCard card = (BaseballCard)result.ViewData.Model;

            // Test the view model contains a list of fish
            Assert.IsNotNull(card, "The card does not exist");
            Assert.IsTrue(card.Player == mockCards[1].Player);
        }
All Usage Examples Of CardShop.Controllers.BaseballCardController::Delete