public string Put(Ruimtes ruim) { try { string query = @"update dbo.Ruimtes set Locatie ='" + ruim.Locatie + @"', Capaciteit ='" + ruim.Capaciteit + @"' where RuimteId = " + ruim.RuimteId + @" "; DataTable table = new DataTable(); using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["MReserverenDB"].ConnectionString)) using (var cmd = new SqlCommand(query, con)) using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.Text; da.Fill(table); } return("Ruimte is gewijzigd!!"); } catch (Exception) { return("Ruimte wijzigen is mislukt!!"); } }
public string Post(Ruimtes ruim) { try { string query = @"insert into dbo.Ruimtes values ('" + ruim.Locatie + @"', '" + ruim.Capaciteit + @"') "; DataTable table = new DataTable(); using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["MReserverenDB"].ConnectionString)) using (var cmd = new SqlCommand(query, con)) using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.Text; da.Fill(table); } return("Ruimte is toegevoegd!!"); } catch (Exception) { return("Ruimte toevoegen is mislukt!!"); } }