async public Task updateDevice(val v1) { using var cmd = Db.Connection.CreateCommand(); cmd.CommandText = "updatedevice"; cmd.CommandType = CommandType.StoredProcedure; BindDeviceput(cmd, v1); await cmd.ExecuteNonQueryAsync(); }
async public Task addDevice(val v) { using var cmd = Db.Connection.CreateCommand(); cmd.CommandText = "insertdevice"; cmd.CommandType = CommandType.StoredProcedure; BindDevice(cmd, v); await cmd.ExecuteNonQueryAsync(); }
private void BindDevice(MySqlCommand cmd, val v) { cmd.Parameters.Add(new MySqlParameter("device_type_id", v.device_type_id)); cmd.Parameters.Add(new MySqlParameter("device_brand_id", v.device_brand_id)); cmd.Parameters.Add(new MySqlParameter("model", v.model)); cmd.Parameters.Add(new MySqlParameter("color", v.color)); cmd.Parameters.Add(new MySqlParameter("price", v.price)); cmd.Parameters.Add(new MySqlParameter("serial_number", v.serial_number)); cmd.Parameters.Add(new MySqlParameter("warranty_year", v.warranty_year)); cmd.Parameters.Add(new MySqlParameter("purchase_date", v.purchase_date)); cmd.Parameters.Add(new MySqlParameter("status_id", v.status_id)); cmd.Parameters.Add(new MySqlParameter("specification_id", v.specification_id)); cmd.Parameters.Add(new MySqlParameter("entry_date", v.entry_date)); }