public void updateActivity(Activity anActivity) { using (SqlCommand cmd = DatabaseContext.Connection.CreateCommand()) { cmd.CommandText = "update Activity set ActivityName=" + "'" + anActivity.ActivityName + "'" + ",Rate=" + "'" + anActivity.Rate + "where ActivityNo=" + anActivity + ";"; cmd.ExecuteNonQuery(); } }
public Activity getActivityByNo(int no) { Activity result = null; using (SqlCommand cmd = new SqlCommand("select * from activity where activityname= " + no, DatabaseContext.Connection)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { result = new Activity { ActivityName = reader["ActivityName"].ToString() }; } } return result; }
public Activity getActivityByName(String name) { Activity result = null; using (SqlCommand cmd = new SqlCommand("select activityNo from activity where activityname='" + name + "';", DatabaseContext.Connection)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { result = new Activity { ActivityNo = Convert.ToInt32(reader["ActivityNo"]) }; } reader.Close(); } return result; }
private void updateActivity() { Activity anActivity = new Activity { ActivityNo = Int32.Parse(tbAdminActivityNo.Text), ActivityName = tbAdminActivityName.Text.ToString(), Rate = Int32.Parse(tbAdminActivityRate.Text), }; context.ActivityService.updateActivity(anActivity); }
public void updateActivity(Activity anActivity) { context.ActivityRepository.updateActivity(anActivity); }