Exemple #1
0
        public ActionResult GetStudents()
        {
            clsStudent        oStudent      = new clsStudent();// used Business
            List <clsStudent> ListaStudents = new List <clsStudent>();

            ListaStudents = ConvertDataTable <clsStudent>(oStudent.GetStudentsSortedName());
            return(Json(ListaStudents, JsonRequestBehavior.AllowGet));
        }
        //Method for get Students
        public static void ListStudents()
        {
            clsStudent oStudent      = new clsStudent();
            var        vDataStudents = oStudent.GetStudentsSortedName();

            Console.WriteLine("-----Students List sorted by name-----");
            int count = 0;

            foreach (DataRow datarow in vDataStudents.Rows)
            {
                count++;
                Console.WriteLine("***************** Record " + count + "********************");
                Console.WriteLine(datarow[0].ToString() + " " + datarow[1].ToString() + " " + datarow[2].ToString() + " " + datarow[3].ToString() + " " + datarow[4].ToString());
            }
        }
        public void GetStudents_Test()
        {   //Instance the object
            clsStudent oStudent = new clsStudent();
            var        vResult  = oStudent.GetStudentsSortedName();

            Assert.IsNotNull(vResult, "Test");
            Console.WriteLine("-----Test Get Students sorted by name-----");
            int count = 0;

            foreach (DataRow datarow in vResult.Rows)
            {
                count++;
                Console.WriteLine("***************** Record " + count + "********************");
                Console.WriteLine(datarow[0].ToString() + " " + datarow[1].ToString() + " " + datarow[2].ToString() + " " + datarow[3].ToString() + " " + datarow[4].ToString());
            }
        }