コード例 #1
0
        public void GetAllCustomers()
        {
            var customers = storeRepo.GetCustomers();

            Console.WriteLine($"Customer ID\t\tFirst Name\t\tLast Name\t\tEmail");
            foreach (var customer in customers)
            {
                Console.WriteLine($"{customer.CustomerId}\t\t\t{customer.FirstName}\t\t\t{customer.LastName}\t\t\t{customer.Email}");
            }
        }
コード例 #2
0
        //GET - Customer
        public IActionResult Index(string searchString)
        {
            var customers = _storeRepo.GetCustomers();

            if (!String.IsNullOrEmpty(searchString))
            {
                string[] nameList  = searchString.Split(' '); ///[firstname, lastname]
                string   firstName = nameList[0];
                string   lastName  = nameList[1];
                customers = _storeRepo.GetCustomerByName(firstName, lastName);

                return(View(customers));
            }
            return(View(customers));
        }
コード例 #3
0
        //CREATE

        public ActionResult Create()

        {
            var locations = _storeRepo.GetLocations();

            var customers = _storeRepo.GetCustomers();

            var newOrder = new OrderViewModel();

            foreach (var customer in customers)
            {
                newOrder.Customers.Add(customer);
            }
            foreach (var location in locations)
            {
                newOrder.Locations.Add(location);
            }
            ;

            return(View(newOrder));
        }