コード例 #1
0
        public object Get(Customer customer)
        {
            if (customer.CustomerId == null)
                return CustomerRepository.Read();

            return CustomerRepository.ReadCustomer(customer.CustomerId);
        }
コード例 #2
0
 public static Customer Update(Customer cust)
 {
     var customer = _customers.FirstOrDefault(c => c.CustomerId == cust.CustomerId);
     customer.Name = cust.Name;
     customer.Phone = cust.Phone;
     customer.Address = cust.Address;
     return customer;
 }
コード例 #3
0
 public static void Delete(Customer cust)
 {
     var customer = _customers.FirstOrDefault(c => c.CustomerId == cust.CustomerId);
     _customers.Remove(customer);
 }
コード例 #4
0
 public static Customer Create(Customer cust)
 {
     cust.CustomerId = _index++;
     _customers.Add(cust);
     return cust;
 }
コード例 #5
0
 public object Delete(Customer customer)
 {
     CustomerRepository.Delete(customer);
     return null;
 }
コード例 #6
0
 public object Put(Customer customer)
 {
     return CustomerRepository.Update(customer);
 }
コード例 #7
0
 public object Post(Customer customer)
 {
     return CustomerRepository.Create(customer);
 }