public bool Post(ProcessActivity processActivity) { SqlCommand cmd = new SqlCommand(INSERT, SQLConnectionSingleton.Instance.DbConnection); cmd.Parameters.AddWithValue("@ActivityID ", processActivity.ActivityID); cmd.Parameters.AddWithValue("@ProcessOrderNR ", processActivity.ProcessOrderNR); int rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected == 1); }
public ProcessActivity Get(int ProcessOrderNR) { ProcessActivity processActivity = null; using (SqlCommand cmd = new SqlCommand(GET_ONE, SQLConnectionSingleton.Instance.DbConnection)) { cmd.Parameters.AddWithValue("@ProcessOrderNR", ProcessOrderNR); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { processActivity = new ProcessActivity() { ActivityID = reader.GetInt32(0), ProcessOrderNR = reader.GetInt32(1) }; } reader.Close(); } return(processActivity); }