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"));
     }
 }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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);
            }
        }