public bool DeleteCustomer(Customer aCustomer) { try { var bookingList = GetBookingList().ToList(); if (bookingList != null) { var result = !bookingList.Any(b => b.CustomerId.Equals(aCustomer.Id)); if (result) { return Db.DeleteCustomer(aCustomer); } else { return false; } } else { return Db.DeleteCustomer(aCustomer); } } catch { throw; } }
public bool AddCustomer(Customer customer) { try { var isExist = Db.GetCustomer().Any(v => v.Name.Equals(customer.Name)); if (isExist) return false; else return Db.AddCustomer(customer); } catch { throw; } }
public bool UpdateCustomer(Guid key, Customer aCustomer) { try { return Db.UpdateCustomer(key, aCustomer); } catch (Exception) { throw; } }
//Delete Method in Database Class public bool DeleteCustomer(Customer aCustomer) { try { foreach (KeyValuePair<Guid, Customer> customer in customerList) { if (customer.Value.Equals(aCustomer)) { return customerList.Remove(customer.Key); } } return false; } catch { throw new VideoRentalException(new Customer() { Name = aCustomer.Name }); } }