Ejemplo n.º 1
0
        public JsonResult StudentAvaliable(jQueryDataTableParamModel param, string subjectId)
        {
            Business.SubjectBusiness subject          = new Business.SubjectBusiness();
            Business.StudentBusiness student          = new Business.StudentBusiness();
            List <Students>          studentAvaliable = new List <Students>();
            List <Students>          studentsAll      = student.GetAll().ToList();
            var subjectList = subject.GetStudentsBySubject(subjectId);

            foreach (var item in studentsAll)
            {
                bool studentExist = subjectList.FirstOrDefault(a => a.Id == item.Id) != null;
                if (!studentExist)
                {
                    studentAvaliable.Add(item);
                }
            }


            List <string[]> data = new List <string[]>();

            foreach (Domain.Students item in studentAvaliable)
            {
                //int students = item.Students != null ? item.Students.Count : 0;
                data.Add(new string[] { item.Id + string.Empty, item.firstName, item.lastName + string.Empty, item.gender, item.age + string.Empty, item.phoneNumber });
            }

            return(Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = 10,
                iTotalDisplayRecords = 3,
                aaData = data
            },
                        JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult StudentList(jQueryDataTableParamModel param, string subjectId)
        {
            Business.SubjectBusiness subject = new Business.SubjectBusiness();
            List <string[]>          data    = new List <string[]>();
            var subjectList = subject.GetStudentsBySubject(subjectId);

            foreach (Domain.Students item in subjectList)
            {
                //int students = item.Students != null ? item.Students.Count : 0;
                data.Add(new string[] { item.Id + string.Empty, item.firstName, item.lastName + string.Empty, item.gender, item.age + string.Empty, item.phoneNumber });
            }

            return(Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = 10,
                iTotalDisplayRecords = 3,
                aaData = data
            },
                        JsonRequestBehavior.AllowGet));
        }