示例#1
0
        //truyền ob_ID từ controllers
        public void delete(string id)
        {
            CSubject cSubject = new CSubject();
            var      sub      = cSubject.findAll().Where(i => i.Course_Code == id).SingleOrDefault();

            this.mongo.DeleteByObjectId <Subjects>("Subjects", sub._id);
        }
示例#2
0
        //Truyền record từ controllers
        public void Update(string subId, Subjects subjects)
        {
            cSub = new CSubject();
            var subs = cSub.findAll();
            var sub  = this.mongo.ReadByObjectId <Subjects>("Subjects", new ObjectId(subs.Where(s => s.Course_Code == subId).SingleOrDefault()._id.ToString()));

            sub.Prerequisite = subjects.Prerequisite;
            sub.Course_Name  = subjects.Course_Name;
            sub.Credits      = subjects.Credits;
            sub.Course_Code  = subjects.Course_Code;
            sub.Semester     = subjects.Semester;
            this.mongo.Update <Subjects>("Subjects", sub._id, sub);
        }
示例#3
0
        public SelfStudies findfromsubject(string id)
        {
            cSub = new CSubject();
            var subs   = cSub.findAll();
            var sub_id = subs.Where(s => s.Course_Code.Equals(id)).SingleOrDefault();

            if (sub_id.SelfStudy_ID.ToString() != "")
            {
                var SS_id  = new ObjectId(sub_id.SelfStudy_ID.ToString());
                var result = this.mongo.ReadByObjectId <SelfStudies>("SelfStudies", SS_id);
                return(result);
            }
            else
            {
                return(null);
            }
        }
示例#4
0
        public Chapters findfromsubject(string id)
        {
            cSub = new CSubject();
            var subs   = cSub.findAll();
            var sub_id = subs.Where(s => s.Course_Code.Equals(id)).SingleOrDefault();

            if (sub_id.Chapter_ID.ToString() != "")
            {
                var chapter_id = new ObjectId(sub_id.Chapter_ID.ToString());
                var result     = this.mongo.ReadByObjectId <Chapters>("Chapters", chapter_id);
                return(result);
            }
            else
            {
                return(null);
            }
        }
示例#5
0
        public ProgramOutStandards findfromsubject(string id)
        {
            cSub = new CSubject();
            var subs   = cSub.findAll();
            var sub_id = subs.Where(s => s.Course_Code.Equals(id)).SingleOrDefault();

            if (sub_id.ProgramOutStandar_ID.ToString() != "")
            {
                var POS_id = new ObjectId(sub_id.ProgramOutStandar_ID.ToString());
                var result = this.mongo.ReadByObjectId <ProgramOutStandards>("ProgramOutStandards", POS_id);
                return(result);
            }
            else
            {
                return(null);
            }
        }