public int?createPot(Pots pot) { Potters potter = this.getPotterById(pot.PottersId); if (potter == null) { return(null); } return((new PotsContext(connectionString)).createPot(pot)); }
public int?createPotter(Potters potter) { (int?id, String name, String country) = potter; using (MySqlConnection conn = getConnection()) { conn.Open(); MySqlCommand command = new MySqlCommand("insert into potters (Name, Country) values (?name, ?country)", conn); command.Parameters.AddWithValue("?name", name); command.Parameters.AddWithValue("?country", country); int affected = command.ExecuteNonQuery(); if (affected == 1) { return((int)command.LastInsertedId); } conn.Close(); } return(null); }
public int?createPotter(Potters potter) { return((new PottersContext(connectionString)).createPotter(potter)); }