public async Task<IActionResult> Put(JednostkiChorobowe jednostkaChorobowa) { var connectionString = "Data Source=D:\\bazy\\Bazy\\ff.db"; using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { SQLiteCommand command = new SQLiteCommand($"UPDATE JednostkiChorobowe SET Choroba='{jednostkaChorobowa.Choroba}' WHERE id = {jednostkaChorobowa.Id}", connection); await connection.OpenAsync(); command.ExecuteNonQuery(); connection.Close(); } return StatusCode(201); }
public async Task<IActionResult> Post(JednostkiChorobowe jednostkaChorobowa) { var results = new List<JednostkiChorobowe>(); var connectionString = "Data Source=D:\\bazy\\Bazy\\ff.db"; using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { SQLiteCommand command2 = new SQLiteCommand($"INSERT INTO JednostkiChorobowe (Choroba) VALUES ('{jednostkaChorobowa.Choroba}')", connection); await connection.OpenAsync(); command2.ExecuteNonQuery(); connection.Close(); } return StatusCode(201,results); }