public static void findCustomerbyName() { var context = new projectZeroContext(Options); //var customer = context.Customer.Find(0,"Jack Pflug"); Console.WriteLine("What is the customers full name? ie. Firstname Lastname"); var customerName = Console.ReadLine(); var searchcustomer = new Customer { FullName = customerName }; foreach (var customer in context.Customer) { if (searchcustomer.FullName.Equals(customer.FullName)) { Console.WriteLine($"{customer.FullName} is in our database!"); } else { } } }
public static void findOrdersAtLocation() { Console.WriteLine("What store location would you like to search?"); storeRepo.getStores(); var searchlocation = Console.ReadLine(); var searchOrderbyLocation = new CustomerOrder { LocationName = searchlocation }; var context = new projectZeroContext(Options); foreach (var search in context.CustomerOrders) { if (searchOrderbyLocation.LocationName.Equals(search.LocationName)) { Console.WriteLine($"{search.LocationName } orders: OrderId#{search.OrderId} Customer name:{search.CustomerName} "); } else { Console.WriteLine("no orders were found at this location"); } } }
public CustomerRepo(projectZeroContext context) : base(context) { }
public CustomerController(ICustomerRepository custrepo, projectZeroContext context) { _customerRepo = custrepo; _context = context; }
public CustomerRepo(projectZeroContext dbContext) { _projectZeroContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); }