public object Get(Customer customer) { if (customer.CustomerId == null) return CustomerRepository.Read(); return CustomerRepository.ReadCustomer(customer.CustomerId); }
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; }
public static void Delete(Customer cust) { var customer = _customers.FirstOrDefault(c => c.CustomerId == cust.CustomerId); _customers.Remove(customer); }
public static Customer Create(Customer cust) { cust.CustomerId = _index++; _customers.Add(cust); return cust; }
public object Delete(Customer customer) { CustomerRepository.Delete(customer); return null; }
public object Put(Customer customer) { return CustomerRepository.Update(customer); }
public object Post(Customer customer) { return CustomerRepository.Create(customer); }