public void Delete(SpecialistServiceBindingModel model) { try { using (var command = new NpgsqlCommand("DELETE FROM specialist_service WHERE specialist_id=@specialistId AND service_id=@serviceId", source.npgsqlConnection)) { command.Parameters.AddWithValue("specialistId", model.SpecialistId); command.Parameters.AddWithValue("serviceId", model.ServiceId); command.ExecuteNonQuery(); } } catch (Exception) { throw; } }
public void Create(SpecialistServiceBindingModel model) { try { using (var command = new NpgsqlCommand("INSERT INTO specialist_service(specialist_id, service_id)" + "VALUES (@specialistId, @serviceId)", source.npgsqlConnection)) { command.Parameters.AddWithValue("specialistId", model.SpecialistId); command.Parameters.AddWithValue("serviceId", model.ServiceId); command.ExecuteNonQuery(); } } catch (Exception) { throw; } }