コード例 #1
0
        //Faculty Controller
        public async Task <IActionResult> Faculty()
        {
            var getallFaculty = new GetFaculty();
            var allFaculty    = await getallFaculty.GetAllFaculty();

            var sortedFaculty    = allFaculty.OrderBy(f => f.username);
            var facultyViewModel = new FacultyViewModels()
            {
                Faculty = allFaculty.ToList(),
                Title   = "This is your Faculty"
            };

            return(View(facultyViewModel));
        }
コード例 #2
0
        /**
         * Reponsible for creating Faculty page when loaded in
         * This data includes information on the faculty data provided by the API
         */
        public async Task <IActionResult> Faculty()
        {
            // Create service object
            var getallFaculty = new GetFaculty();
            // Call method from service object that returns List of faculty, wait for reponse to move on
            var allFaculty = await getallFaculty.GetAllFaculty();

            // Sorts List from last call
            var sortedFaculty = allFaculty.OrderBy(f => f.username);
            // Create view model using the given list and title
            var facultyViewModel = new FacultyViewModel()
            {
                Faculty = sortedFaculty.ToList(),
                Title   = "This is Our Faculty"
            };

            // returns created view, this process is similar for the functions below
            return(View(facultyViewModel));
        }