예제 #1
0
 private void DeleteBtnClicked(object sender, RoutedEventArgs e)
 {
     try
     {
         Button        btn = (Button)sender;
         Advertisement ad  = (Advertisement)btn.DataContext;
         _service.RemoveAd(ad.Id);
         _window.Content = new AdPage(_window);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
예제 #2
0
        public void TestDeleteAds()
        {
            Advertisement ad = new Advertisement
            {
                Title       = "A",
                Description = "A",
                Price       = 50,
                StartDate   = DateTime.Now,
                EndDate     = DateTime.Now.AddDays(7),
                BikeId      = bicycleDB.GetAllBicycles().Last().ID,
                UserID      = userDB.GetAllUser().Last().Id,
            };

            advertisementDB.AddAd(ad);

            Advertisement a = advertisementDB.GetAllAds().Last();

            client.RemoveAd(a.Id);

            Assert.AreNotEqual(advertisementDB.GetAllAds().Last().Id, a.Id);
        }
예제 #3
0
 public ActionResult DeleteAd(int id)
 {
     client.RemoveAd(id);
     return(RedirectToAction("Index", "Ads"));
 }