Example #1
0
        public List <Students> GetAllGoing()
        {
            List <Attend> attendList         = new List <Attend>();
            StudentCompetitionEntities tstDb = new StudentCompetitionEntities();
            var lstAttd = from k in tstDb.Attends select k;

            List <Students> studentListGoing = new List <Students>();
            var             lstStd           = from k in tstDb.Students select k;

            foreach (var stdItem in lstStd)
            {
                foreach (var attdItem in lstAttd)
                {
                    if (stdItem.StudentId == attdItem.StudentId && attdItem.AcceptRegret == "Accepted")
                    {
                        Students usr = new Students();
                        usr.StudentId             = stdItem.StudentId;
                        usr.Name                  = stdItem.Name;
                        usr.Email                 = stdItem.Email;
                        usr.Phone                 = stdItem.Phone;
                        usr.TechnicalInterest     = stdItem.TechnicalInterest;
                        usr.SocialNetworkInterest = stdItem.SocialNetworkInterest;
                        usr.AcceptRegret          = attdItem.AcceptRegret;
                        studentListGoing.Add(usr);
                    }
                }
            }

            return(studentListGoing);
        }
Example #2
0
        public Students GetGoingById(int id)
        {
            StudentCompetitionEntities tstDb = new StudentCompetitionEntities();
            Students usr = new Students();

            List <Attend> attendList = new List <Attend>();
            var           lstAttd    = from k in tstDb.Attends where k.StudentId == id select k;


            List <Students> studentListGoing = new List <Students>();
            var             lstStd           = from k in tstDb.Students where k.StudentId == id select k;

            foreach (var stdItem in lstStd)
            {
                foreach (var attdItem in lstAttd)
                {
                    if (stdItem.StudentId == attdItem.StudentId)
                    {
                        usr.StudentId             = stdItem.StudentId;
                        usr.Name                  = stdItem.Name;
                        usr.Email                 = stdItem.Email;
                        usr.Phone                 = stdItem.Phone;
                        usr.TechnicalInterest     = stdItem.TechnicalInterest;
                        usr.SocialNetworkInterest = stdItem.SocialNetworkInterest;
                        usr.AcceptRegret          = attdItem.AcceptRegret;
                    }
                }
            }


            return(usr);
        }
Example #3
0
        public int AddStudent(int StudentId, string Name, string Email, string Phone, string TechnicalInterest, string SocialNet, string accRegret)
        {
            Student student = new Student();

            student.StudentId             = StudentId;
            student.Name                  = Name;
            student.Email                 = Email;
            student.Phone                 = Phone;
            student.TechnicalInterest     = TechnicalInterest;
            student.SocialNetworkInterest = SocialNet;


            Attend attendance = new Attend();

            attendance.StudentId    = StudentId;
            attendance.AcceptRegret = accRegret;


            StudentCompetitionEntities tstDb = new StudentCompetitionEntities();

            tstDb.Students.Add(student);
            tstDb.Attends.Add(attendance);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }