コード例 #1
0
        public ActionResult DeleteRetailer(int id)
        {
            Retailer thisRetailer = Retailer.Find(id);

            thisRetailer.Delete();
            return(RedirectToAction("AllRetailers"));
        }
コード例 #2
0
        public void Delete_DeletesRetailerAssociationsFromDatabase_RetailerList()
        {
            Game testGame = new Game("Super Mario 64", "Platformer", "Nintendo 64", 1996, 98);

            testGame.Save();

            Retailer testRetailer = new Retailer("GameStop", "www.GameStop.com");

            testRetailer.Save();

            testRetailer.AddGame(testGame);
            testRetailer.Delete();

            List <Retailer> resultGameRetailers = testGame.GetRetailers();
            List <Retailer> testGameRetailers   = new List <Retailer> {
            };

            CollectionAssert.AreEqual(testGameRetailers, resultGameRetailers);
        }