public static void RemoveCoupon(int CouponID) { using (basicEntities be = new basicEntities()) { Coupon.Coupon CouponToRemove = be.Coupons.Find(CouponID); string Businessid = CouponToRemove.Business.BusinessID; be.Coupons.Remove(CouponToRemove); be.SaveChanges(); TestBusiness.RemoveBusinesses(Businessid); be.SaveChanges(); } }
public void Cleanup() { using (basicEntities be = new basicEntities()) { if (be.Coupons.Find(coupon) != null) { be.Coupons.Remove(be.Coupons.Find(coupon)); be.SaveChanges(); TestBusiness.RemoveBusinesses(Businessid); be.SaveChanges(); } } }
public static void DeleteAllBusiness() { using (basicEntities be = new basicEntities()) { var query = from b in be.Businesses select b; foreach (Coupon.Business item in query) { TestBusiness.RemoveBusinesses(item.BusinessID); } } }