public void SetDTO() { DataModelItemEntity = new DataModelItemDTO { Id = null, Name = Name, DataModel = CurrentDataModel.GetDTO() }; }
public List <DataModelItemDTO> SelectDataItems(DataModelDTO dto) { try { _db.Connection.Open(); string sql = "SELECT * FROM data_model_item WHERE id_data_model = @id"; MySqlCommand comm = _db.Connection.CreateCommand(); comm.CommandText = sql; comm.Parameters.AddWithValue("@id", dto.Id); MySqlDataReader reader = comm.ExecuteReader(); List <DataModelItemDTO> items = new List <DataModelItemDTO>(); int id; string name; while (reader.Read()) { id = int.Parse(reader["id"].ToString()); name = reader["name"].ToString(); DataModelItemDTO itemdto = new DataModelItemDTO { Id = id, Name = name }; items.Add(itemdto); } return(items); } catch (MySqlException ex) { throw new Exception(ex.ToString()); } finally { _db.Close(); } }
public void NewDataModelItem(DataModelItemDTO dto) { mDataModelItem.Insert(dto); }
public DataModelItem() { mDataModelItem = new DataModelItemDAO(); DataModelItemEntity = new DataModelItemDTO(); }