public async void DeleteDevice(Customer cust) { await _repo.DeleteCustomerAsync(cust.Id); _allCustomers = await _repo.GetCustomersAsync(); Customers = new ObservableCollection <Customer>(_allCustomers); }
public async Task <ActionResult> DeleteCustomer(int id) { var status = await _repo.DeleteCustomerAsync(id); if (!status) { return(NotFound()); } return(Ok(status)); }
private async void OnDelete(Guid customerId) { var customer = _allCustomers.FirstOrDefault(c => c.Id == customerId); _allCustomers.Remove(customer); Customers = new ObservableCollection <Customer>(_allCustomers); await repo.DeleteCustomerAsync(customerId); return; }
public async Task <ActionResult> Delete(int id, Customer customer) { var status = await _CustomersRepo.DeleteCustomerAsync(id); if (!status) { return(View(customer)); } return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteCustomer(Guid id) { var customer = await _customersRepository.GetCustomerAsync(id); if (customer == null) { return(NotFound()); } await _customersRepository.DeleteCustomerAsync(customer); return(NoContent()); }
private async void OnDeleteCustomer(Customer customer) { if (Deleting()) { try { await _repo.DeleteCustomerAsync(customer.Id); Customers.Remove(customer); Deleted(); } catch (Exception ex) { Failed(ex); } } }
private void DeleteCustomer() { if (cus != null) { Task.WaitAll(Task.Run(async() => await _customersRepository.DeleteCustomerAsync(cus))); ClearView(); IsResultFound = Visibility.Collapsed; } else { MessageBox.Show("Can not find the customer", "Notification", MessageBoxButton.OK, MessageBoxImage.Information); ClearView(); IsResultFound = Visibility.Collapsed; } }
public async Task <ActionResult> DeleteCustomer(int id) { try { var status = await _CustomersRepository.DeleteCustomerAsync(id); if (!status) { return(BadRequest(new ApiResponse { Status = false })); } return(Ok(new ApiResponse { Status = true })); } catch (Exception exp) { _Logger.LogError(exp.Message); return(BadRequest(new ApiResponse { Status = false })); } }
public async Task DeleteCustomerAsync(int id) { await _customersRepository.DeleteCustomerAsync(id); await _unitOfWork.CompleteAsync(); }
public async Task <bool> DeleteCustomer(int id) { return(await _repo.DeleteCustomerAsync(id)); }
private void DeleteCustomer(Customer obj) { Task.WaitAll(Task.Run(async() => await _customersRepository.DeleteCustomerAsync(obj))); LoadUI(); }