예제 #1
0
 // GET: CustomerController
 public ActionResult Index()
 {
     return(View(_custBL.GetAllCustomers()
                 .Select(customer =>
                         new CustomerVM(customer))
                 .ToList()));
 }
        public void ViewAllCustomer()
        {
            List <Customer> customers = _customerBL.GetAllCustomers();
            Action <Object> print     = o => Console.WriteLine(o.ToString());

            if (customers.Count == 0)
            {
                Console.WriteLine("No customers :< You should add some");
            }
            else
            {
                customers.ForEach(print);
            }
        }
 /// <summary>
 /// UI to view a list of all customers
 /// </summary>
 private void ViewCustomers()
 {
     try
     {
         // Check if any customers exist and then display all
         List <Customer> customers = _customerBL.GetAllCustomers();
         if (customers.Count == 0)
         {
             Console.WriteLine("No customers found");
         }
         else
         {
             foreach (Customer customer in customers)
             {
                 Console.WriteLine(customer.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }