Beispiel #1
0
        public bool Create(DbObject item)
        {
            if (item == null || _table.Contains(item))
            {
                throw new ArgumentException("Either the table is null or it already exists within database.");
            }

            _table.Add(item as DbTable);
            return(true);
        }
Beispiel #2
0
        public bool Update(DbObject item)
        {
            if (item == null)
            {
                return(false);
            }
            if (Delete(item.Id))
            {
                Create(item);
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public bool Update(DbObject item)
        {
            if (item == null)
            {
                return(false);
            }
            int index = _table.IndexOf(Read(item.Id) as DbTable);

            if (!(index == -1))
            {
                _table[index] = item as DbTable;
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        public bool Create(DbObject item)
        {
            if (item == null || _table.Contains(item))
            {
                return(false);
            }

            foreach (DbObject element in _table)
            {
                if (item.Id == element.Id)
                {
                    return(false);
                }
            }

            _table.Add(item);
            return(true);
        }