public void Delete(DataContracts.Device entity)
        {
            string query = string.Format("DELETE FROM DEVICE WHERE id={0};", entity.ID);

            using (SqlCommand cmd = AccessBD.Connection.CreateCommand())
            {
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();
            }
        }
        public void Insert(DataContracts.Device entity)
        {
            string query = string.Format("INSERT INTO DEVICE(type, uniqueIdentifier, userId) VALUES('{0}', '{1}', '{2}');", entity.type, entity.uniqueIdentifier, entity.userId);

            using (SqlCommand cmd = AccessBD.Connection.CreateCommand())
            {
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 3
0
        public void Update(DataContracts.Device entity)
        {
            Device dev = _source.First(o => o.ID == entity.ID);

            if (dev != null)
            {
                dev.type             = entity.type;
                dev.uniqueIdentifier = entity.uniqueIdentifier;
                dev.userId           = entity.userId;
            }
        }
        public void Update(DataContracts.Device entity)
        {
            string query = string.Format("UPDATE DEVICE SET type='{1}', uniqueIdentifier='{2}', userId={3} WHERE id={0};",
                                         entity.ID,
                                         entity.type,
                                         entity.uniqueIdentifier,
                                         entity.userId);

            using (SqlCommand cmd = AccessBD.Connection.CreateCommand())
            {
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 5
0
 public void Update(DataContracts.Device device)
 {
     _repo.Update(device);
 }
 private List<Device> MapDEVICE(IDataReader dataReader)
 {
     List<Device> list = new List<Device>();
     while (dataReader.Read())
     {
         Device device = new Device()
         {
             ID = Tools.ChangeType<int>(dataReader["id"]),
             type = Tools.ChangeType<string>(dataReader["type"]),
             uniqueIdentifier = Tools.ChangeType<string>(dataReader["uniqueIdentifier"]),
             userId = Tools.ChangeType<int>(dataReader["userId"])
         };
         list.Add(device);
     }
     return list;
 }
Esempio n. 7
0
 public void Delete(DataContracts.Device entity)
 {
     _source.RemoveAll(o => o.ID == entity.ID);
 }
Esempio n. 8
0
 public void Insert(DataContracts.Device entity)
 {
     _source.Add(entity);
 }
Esempio n. 9
0
 public void Insert(Device entity)
 {
     _repo.Insert(entity);
 }
Esempio n. 10
0
 public void Delete(Device entity)
 {
     _repo.Delete(entity);
 }