コード例 #1
0
 public ActionResult Delete(int id, opportunity opportunity)
 {
     if (ModelState.IsValid)
     {
         opportunity = op.GetById(id);
         op.Delete(opportunity);
         op.Commit();
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
        public void TestDelete()
        {
            this.TestAdd();

            ConfigurationHelper.Ensure();
            var service = new OpportunityService();

            var countBefore = service.GetAll().Count();

            var maxId = service.GetAll().Max(i => i.Id);

            service.Delete(maxId);

            var countAfter = service.GetAll().Count();

            Assert.Equal(countBefore, countAfter + 1);
        }