コード例 #1
0
 // GET: CustomerController
 public ActionResult Index()
 {
     return(View(_custBL.GetAllCustomers()
                 .Select(customer =>
                         new CustomerVM(customer))
                 .ToList()));
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 /// <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);
     }
 }