public int delete(selfTreatmentModel komen) { str = "delete from komen where id_komen = @1"; using (MySqlCommand cmd = new MySqlCommand(str, conn)) { cmd.Parameters.AddWithValue("@1", komen.IdKomen); return(cmd.ExecuteNonQuery()); } }
public int save(selfTreatmentModel komen) { str = "insert into komen(komen_isi, komen_timestamp, id_user, id_post) values (@1, @2, @3, @4)"; using (MySqlCommand cmd = new MySqlCommand(str, conn)) { cmd.Parameters.AddWithValue("@1", komen.KomenIsi); cmd.Parameters.AddWithValue("@2", komen.KomenTimestamp); cmd.Parameters.AddWithValue("@3", ConfigurationManager.AppSettings["userid"]); cmd.Parameters.AddWithValue("@4", ConfigurationManager.AppSettings["postid"]); return(cmd.ExecuteNonQuery()); } }