示例#1
0
        public ViewResult ViewStudent(int id)
        {
            Student stu = _student.GetStudent(id); //fetch the student object

            List <Guarantor> guarantor = _guarantorRepo.GetAllGuarantor().Where(g => g._student_id == stu.ID).ToList();

            List <Project> project = _projectRepo.GetAllProjects().Where(p => p.StudentId == stu.ID).ToList();

            StudentInBatch studentInBatch = _studentBatchRepo.GetAllStudentInBatchs().Where(s => s.Student_Id == stu.ID).FirstOrDefault();

            if (studentInBatch != null)
            {
                Batch batch = _batchRepo.GetAllBatch().Where(b => b.Id == studentInBatch.Batch_Id).FirstOrDefault(); // pass the batch id to the GetBatch method to fetch an object of the batch

                Programme program = _programRepo.GetAllProgrammes().Where(p => p.Id == batch.Program_Id).FirstOrDefault();

                if (studentInBatch != null || batch != null || program != null || guarantor != null || project != null)
                {
                    DashboardView dashboardView1 = new DashboardView()
                    {
                        student   = stu,
                        batch     = batch,
                        project   = project,
                        program   = program,
                        guarantor = guarantor,
                        pageTitle = "Student View"
                    };
                    return(View(dashboardView1));
                }
                else
                {
                    DashboardView dashboardView = new DashboardView()
                    {
                        student   = stu,
                        error     = "This Information is not Avialable at the Moment",
                        pageTitle = "Student View"
                    };
                    return(View(dashboardView));
                }
            }
            else
            {
                DashboardView dashboardView = new DashboardView()
                {
                    student   = stu,
                    error     = "This Information is not Avialable at the Moment",
                    pageTitle = "Student View"
                };
                return(View(dashboardView));
            }
        }
示例#2
0
 public ViewResult Read()
 {
     return(View(_guarantor.GetAllGuarantor()));
 }