Esempio n. 1
0
 public Category Update(Category entity)
 {
     Debug.WriteLine("UPDATING category in database");
     var existing = Categories.First(c => c.ID == entity.ID);
     Mapper.Map(entity, existing);
     return entity;
 }
Esempio n. 2
0
 public Category Insert(Category entity)
 {
     lock (_lockObject)
     {
         Debug.WriteLine("INSERTING category into database");
         var nextID = Categories.Max(c => c.ID) + 1;
         entity.ID = nextID;
         Categories.Add(Mapper.Map(entity, new Category()));
         return entity;
     }
 }
Esempio n. 3
0
 public async Task<Category> UpdateAsync(Category entity)
 {
     return Update(entity);
 }
Esempio n. 4
0
 public async Task<Category> InsertAsync(Category entity)
 {
     return Insert(entity);
 }