コード例 #1
0
 public IEnumerable<Customer> Get()
 {
     using (CustomerContext Context = new CustomerContext())
     {
       return Context.Customers.ToList();
     }
 }
コード例 #2
0
        public Customer NewCustomer([FromBody] Customer newCustomer)
        {
            using (CustomerContext Context = new CustomerContext())
              {
            Context.Customers.Add(newCustomer);
            Context.SaveChanges();
              }

              return newCustomer;
        }