示例#1
0
 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;
 }
示例#2
0
 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;
     }
 }
示例#3
0
 public async Task<Customer> UpdateAsync(Customer entity)
 {
     return Update(entity);
 }
示例#4
0
 public async Task<Customer> InsertAsync(Customer entity)
 {
     return Insert(entity);
 }