示例#1
0
        public static async Task <IActionResult> DeleteCustomerById([HttpTrigger(AuthorizationLevel.Function, "delete", Route = "customers/{id}")] HttpRequest req, string id, ILogger log)
        {
            var customerRepo = new CustomerRepo(new ConnectionString());

            customerRepo.Delete(int.Parse(id));
            return(new OkObjectResult("ok"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            客戶資料 客戶資料 = CustomerRepo.Find(id);

            CustomerRepo.Delete(客戶資料);
            CustomerRepo.UnitOfWork.Commit();

            return(RedirectToAction("Index"));
        }
示例#3
0
        public void TestDeleteCustomer()
        {
            var toDelete = _cr.GetByEmail("*****@*****.**");

            _cr.Delete(toDelete);
            var isDeleted = _cr.GetByEmail("*****@*****.**");

            Assert.IsTrue(isDeleted == null);
        }
示例#4
0
        public void TestDeleteOrder()
        {
            var readByIdAgain = _or.Get(createdId);

            _or.Delete(readByIdAgain);
            var isDeleted = _or.Get(createdId);

            Assert.IsTrue(isDeleted == null);
            _cr.Delete(createdCustomer);
        }
        public IHttpActionResult DeleteCustomer(int id)
        {
            Customer customer = _cr.Get(id);

            if (customer == null)
            {
                return(NotFound());
            }
            _cr.Delete(customer);
            return(Ok(customer));
        }
示例#6
0
        public void ShouldDeleteCustomerWithRepo()
        {
            var cust = new Customer {
                Name = "Best Brakes"
            };

            _repo.Add(cust, false);
            _repo.SaveChanges();
            Assert.AreEqual(1, _repo.Count);
            _repo.Delete(cust, false);
            Assert.AreEqual(EntityState.Deleted, _repo.Context.Entry(cust).State);
            _repo.SaveChanges();
            Assert.AreEqual(0, _db.Customers.Count());
        }
        public async Task <ActionResult <Customer> > DeleteCustomer(int id)
        {
            try
            {
                var targetObj = await _customerRepo.FindByID(id);

                if (targetObj == null)
                {
                    return(NotFound($"Customer with ID = {id} not found !"));
                }

                return(await _customerRepo.Delete(id));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Error deleting Data"));

                throw;
            }
        }
示例#8
0
 public void Delete(SQLiteConnection connection, Customer customer)
 {
     CustomerRepo.Delete(connection, customer);
 }
示例#9
0
 public void DeleteCustomer(long id)
 {
     ReadCustomerById(id);
     _customerRepo.Delete(id);
     ReadCustomerById(id);
 }
 public void deleteCustomer(int id)
 {
     CustomerRepo.Delete(id);
 }
示例#11
0
 public void DeleteCustomer(Customer customer)
 {
     customerRepo.Delete(customer);
 }
示例#12
0
 public bool Delete(int id)
 {
     return(_customerRepo.Delete(id));
 }