public IActionResult SearchCustomer(Customer customer) { if (DatabaseControl.CustomerExists(customer, _context)) { List <Customer> customers = DatabaseControl.CustomersWithName(customer, _context); List <UserAccount> accounts = DatabaseControl.Accounts(customers, _context); return(View("CustomersWithName", accounts)); } else { return(View("CustomerNotFound")); } }
public void CustomerExists_ReturnsFalse() { using (var _context = new P1Context()) { /*DatabaseControl.SetContext(context);*/ Customer customer = new Customer { FirstName = "Thomas", LastName = "Brown" }; bool exists = DatabaseControl.CustomerExists(customer, _context); Assert.False(exists); } }
public void CustomerExists_ReturnsTrue() { using (var _context = new P1Context()) { /*DatabaseControl.SetContext(context);*/ Customer customer = new Customer { FirstName = "Kevin", LastName = "Mora" }; bool exists = DatabaseControl.CustomerExists(customer, _context); Assert.True(exists); } }