// POST partids/values public void Post([FromBody] Partid data) { DatabaseOperations db = new DatabaseOperations(); MySqlCommand command = new MySqlCommand("INSERT INTO Partids(Nume, Pozitie, CreationTime) VALUES(@Nume, @Pozitie, @CreationTime)"); command.Parameters.AddWithValue("@Nume", data.Nume); command.Parameters.AddWithValue("@Pozitie", data.Pozitie); command.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); db.ExecuteQuery(command); }
public static async Task <Partid> AddPartid(Partid partid) { string data; data = ""; try { data = await HttpRequestClient.PostRequest("Partids.php?cmd=addPartid", partid); partid = JsonConvert.DeserializeObject <Partid>(data); } catch (Exception ee) { Console.WriteLine(ee.Message); } return(partid); }