Beispiel #1
0
        public List<Customer> GetCustomers()
        {
            CustomerDbContext dbContext = new CustomerDbContext();
            return dbContext.Customers.ToList();

            //return new List<Customer> {

            //    new Customer{ Id =1, CustomerName = "Alfreds Futterkiste", ContractName="Maria Ander", Address="Obere Str. 57", City="Berlin", PostalCode="12209", Country="German"},
            //    new Customer{ Id =2, CustomerName = "Ana Trujillo Emparedados y helados", ContractName="Ana Trujillo", Address="Avda. de la Constitución 2222", City="México D.F.", PostalCode= "05021", Country="Mixico"},
            //    new Customer{ Id =3, CustomerName = "Antonio Moreno Taquería", ContractName="Antonio Moreno", Address="Mataderos 2312", City="México D.F.", PostalCode="05023", Country="Mexico"},
            //    new Customer{ Id =4, CustomerName = "Around the Horn", ContractName="Thomas Hardy", Address="120 Hanover Sq.", City="London", PostalCode="WA1 1DP", Country="UK"},
            //    new Customer{ Id =5, CustomerName = "Berglunds snabbköp", ContractName = "Christina Berglund", Address="Berguvsvägen 8", City="Luleå", PostalCode= "S-958 22", Country="Sweden"},
            //};
        }
Beispiel #2
0
 public void SaveCustomer(Customer customer)
 {
     CustomerDbContext dbContect = new CustomerDbContext();
     dbContect.Customers.Add(customer);
     dbContect.SaveChanges();
 }