CustomerGetAll() public method

public CustomerGetAll ( ) : IEnumerable
return IEnumerable
        // GET: Customers
        public ActionResult Index()
        {
            // Fetch the collection
            var c = m.CustomerGetAll();

            // Pass the collection to the view
            return(View(c));
        }
        // GET: Customers
        public ActionResult Index()
        {
            // Attention - Error - object reference not set to an instance of an object
            // Just as it says... an object is null, and you're trying to use it
            // Set a breakpoint on line 24 above, then "step over" to get to the error
            // Inspect the variable values as you step through the lines of code

            // Create a new CustomerEditContactInfo object
            // Intentionally leave out some property values
            var newCust = new CustomerEditContactInfo
            {
                //Fax = "(416) 661-4034",
                //Email = "*****@*****.**",
                CustomerId = 2,
                Phone      = "(416) 491-5050"
            };

            // Now, attempt to use some values that are not set
            var email       = newCust.Email;
            var emailLength = email.Length;

            // Fetch the collection
            var c = m.CustomerGetAll();

            // Pass the collection to the view
            return(View(c));
        }
示例#3
0
        // GET: Customers
        public ActionResult Index()
        {
            var c = m.CustomerGetAll();

            return(View(c));
        }