public void GetCustomers() { Console.Clear(); Console.WriteLine("Customer List---"); foreach (var item in _customerBL.GetCustomers()) { Console.WriteLine(item.ToString()); } Console.WriteLine("Press any key to continue"); Console.ReadLine(); }
public void GetAllCustomers() { LineSeparator line = new LineSeparator(); List <Customer> customerList = _customerBL.GetCustomers(); foreach (Customer customer in customerList) { line.LineSeparate(); Console.WriteLine(customer); } line.LineSeparate(); }
public IActionResult CustomerOrders(int?CustomerID = null, int?SortBy = null) { var customers = _customerBL.GetCustomers(); ViewBag.Customers = customers .Select(i => new SelectListItem { Value = i.CustomerId.ToString(), Text = i.Name }).ToList(); ViewBag.SortOptions = GetSortOptions(); CustomerOrdersVM customerOrdersVM = _orderBL.GetCustomerOrdersVM(CustomerID, SortBy); return(View(customerOrdersVM)); }
public void GetCustomers() { Console.Clear(); Console.WriteLine("Customer List---"); foreach (var item in _customerBL.GetCustomers()) { Console.WriteLine(item.ToString()); } }
public void GetCustomers() { Console.WriteLine("Customer First Name: "); string firstName = Console.ReadLine(); Console.WriteLine("Customer Last Name: "); string lastName = Console.ReadLine(); int check = 0; foreach (var item in _customerBL.GetCustomers()) { if (item.FirstName == firstName && item.LastName == lastName) { Console.WriteLine(item.ToString()); check++; } } if (check == 0) { Console.WriteLine("No matching customer found"); } }
public Customer SearchCustomer() { Console.WriteLine("Enter customer's FirstName LastName: "); string name = Console.ReadLine(); int check = 0; foreach (var element in _customerBL.GetCustomers()) { if (element.Name == name) { return(element); } } if (check == 0) { Console.WriteLine("Matching customer not found"); } Customer nullCustomer = null; return(nullCustomer); }
// GET: CustomerController public ActionResult Index(string searchName = null) { // loads the index page for customer var customers = string.IsNullOrWhiteSpace(searchName)?_customerBL.GetCustomers(): _customerBL.GetCustomersByName(searchName); //else after colon // if you have a searchname, call getcustomersbyname...if you dont then get all the customers var customerVMs = new List <CustomerVM>(); foreach (var item in customers) { var customerVM = _mapper.Map <CustomerVM>(item); customerVMs.Add(customerVM); } var customerIndexVM = new CustomerIndexVM(); customerIndexVM.Customers = customerVMs; return(View(customerIndexVM)); }
public void SearchCustomers() { //get users input for first and last name Console.WriteLine("Please enter customers name: "); string userInputName = Console.ReadLine(); //Gets all customers & compares to input foreach (var item in _customerBL.GetCustomers()) { if (item.CustomerName.ToLower() == userInputName.ToLower()) { Console.WriteLine($"\nCustomer found! Welcome {item.CustomerName}!"); Console.WriteLine(item.ToString()); StartShopping(item); } } Console.WriteLine($"Customer {userInputName} was not found."); Start(); }
// GET: CustomerController public ActionResult Index() { //add view Index after migrating DB return(View(_customerBL.GetCustomers().Select(x => _mapper.cast2CustomerIndexVM(x)).ToList())); }