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")); }
public void TestDeleteCustomer() { var toDelete = _cr.GetByEmail("*****@*****.**"); _cr.Delete(toDelete); var isDeleted = _cr.GetByEmail("*****@*****.**"); Assert.IsTrue(isDeleted == null); }
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)); }
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; } }
public void Delete(SQLiteConnection connection, Customer customer) { CustomerRepo.Delete(connection, customer); }
public void DeleteCustomer(long id) { ReadCustomerById(id); _customerRepo.Delete(id); ReadCustomerById(id); }
public void deleteCustomer(int id) { CustomerRepo.Delete(id); }
public void DeleteCustomer(Customer customer) { customerRepo.Delete(customer); }
public bool Delete(int id) { return(_customerRepo.Delete(id)); }