public Customer Update(Customer entity) { Debug.WriteLine("UPDATING customer in database"); var existing = Customers.First(c => c.ID == entity.ID); Mapper.Map(entity, existing); return entity; }
public Customer Insert(Customer entity) { lock (_lockObject) { Debug.WriteLine("INSERTING customer into database"); var nextID = Customers.Max(c => c.ID) + 1; entity.ID = nextID; Customers.Add(Mapper.Map(entity, new Customer())); return entity; } }
public async Task<Customer> UpdateAsync(Customer entity) { return Update(entity); }
public async Task<Customer> InsertAsync(Customer entity) { return Insert(entity); }