public void addCourseGoal(string id, CourseGoal courseGoal) { var obId = ObjectId.GenerateNewId(); CCourseGoals cCourseGoals = new CCourseGoals(); var courseGoalsExist = cCourseGoals.findFromSubject(id); if (!(courseGoalsExist is null)) { courseGoalsExist.Course_Goal.Add(courseGoal); this.mongo.Update <CourseGoals>("CourseGoals", courseGoalsExist._id, courseGoalsExist); }
public UCCourseGoalsEdit(string subId, string coursegoalId, Panel pnl_container, string isAdmin) { InitializeComponent(); this.isAdmin = isAdmin; count_hp = 0; count_ctdt = 0; this.subId = subId; this.pnl_container = pnl_container; coursegoal = cCourseGoals.findFromSubject(subId).Course_Goal.Where(c => c.ID_Goal == coursegoalId).SingleOrDefault(); this.txt_GoalID.Text = coursegoal.ID_Goal; this.coursegoalId = coursegoalId; this.txt_Description.Text = coursegoal.Description_Goal; this.txt_CDRHP.Text = coursegoal.ID_CDR[0].ToString(); this.txt_CDRCTDT.Text = coursegoal.ID_CTDT[0].ToString(); CDRs = coursegoal.ID_CDR; CTDTs = coursegoal.ID_CTDT; max_hp = coursegoal.ID_CDR.Count(); if (max_hp != 0) { min_hp = 1; } else { min_hp = 0; } max_ctdt = coursegoal.ID_CTDT.Count(); if (max_ctdt != 0) { min_ctdt = 1; } else { min_ctdt = 0; } }