//public bool AddCustomerToBannedList(int id, string firstName, string lastName, string email, string reasonForBan, string photo) public bool AddCustomerToBannedList(int i, string firstName, string lastName, string email, string reasonForBan, string photo) { try { // need some code to avoid dulicate usernames // maybe add some logic (busiess rules) about password policy // IUser user = new User(name, password, userType); // Construct a User Object MessageBox.Show("Firstname passed"); MessageBox.Show(firstName); IBannedCustomer customer = BannedCustomerFactory.GetBannedCustomer(i, firstName, lastName, email, reasonForBan, photo); // Using a Factory to create the user entity object. ie seperating object creation from business logic // IBannedCustomer aCust = new BannedCustomer(firstName, lastName, email, reasonForBan, photo); _bannedCustomerList.Add(customer); // MessageBox.Show("customer object received from factory and added to list"); // Add a reference to the newly created object to the Models UserList // DataLayer.AddNewBannedCustomerToDb(firstName, lastName, email, reasonForBan, photo); //Gets the DataLayer to add the new user to the DB. return(true); } catch (System.Exception excep) { MessageBox.Show(excep.ToString()); return(false); } }
public bool DeleteBannedCustomer(IBannedCustomer customer) { DataLayer.deleteBannedCustomerFromDB(customer); BannedCustomerList.Remove(customer); return(true); }