Exemple #1
0
 public async Task <int> Delete(T entity)
 {
     using (var db = new PostgresContext())
     {
         db.Set <T>();
         db.Remove(entity);
         return(await db.SaveChangesAsync());
     }
 }
        public void Delete(int id)
        {
            var testSubTable = _context.TestSubTable.Find(id);

            if (testSubTable == null)
            {
                throw new ItemNotFoundException($"TestSubTable {id} not found.");
            }

            _context.Remove(testSubTable);
            _context.SaveChanges();
        }