Пример #1
0
        public ActionResult GeneratePDPMergedFile(string email)
        {
            if (string.IsNullOrEmpty(email))
            {
                return(View().WithError("No email parameter found!"));
            }


            var sffx     = DateTime.Now.ToString("ddMMyyyyHHmm");
            var fileName = email + "_" + sffx + ".pdf";

            var user = UserManager.FindByEmail(email);


            //generate model here
            var book = new StudentBookViewModel();

            book.StudentName = user.FullName;
            book.AboutMe     = GetAboutMeModel(email);
            book.VarkResult  = GetVarkModel(email);
            book.DopeResult  = GetDopeModel(email);
            book.DiscResult  = GetDiscModel(email);
            book.Kiwiana     = GetKiwianaModel(email);


            return(new ViewAsPdf("MergedPDPView", book)
            {
                FileName = fileName
            });
        }
Пример #2
0
        public async Task <StudentBookViewModel> GetStudentViewModel(string studentId)
        {
            var student = await this.data.StudentClass.Include(sc => sc.Class).FirstOrDefaultAsync(s => s.StudentId == studentId);

            var studentAbsences = await this.data.StudentAbsences.Where(sa => sa.StudentId == studentId).Select(sa => sa.Absences).ToListAsync();

            var studentGrades = await this.data.StudentGrades.Where(sg => sg.StudentId == studentId).ToListAsync();

            var subjects = await this.data.Subjects.Include(s => s.Teacher).Where(s => s.Class.Contains(student.Class)).ToListAsync();

            var classBookModels = new List <StudentBookModel>();

            var subjectGrades = new List <int>();

            foreach (var subject in subjects)
            {
                subjectGrades = studentGrades.Where(sg => sg.Subject.Id == subject.Id).Select(sg => sg.Grade).ToList();
                classBookModels.Add(new StudentBookModel
                {
                    StudentGrades = subjectGrades,
                    SubjectName   = subject.Name,
                });
            }

            var model = new StudentBookViewModel
            {
                StudentBookModel = classBookModels,
                StudentAbsences  = studentAbsences,
            };

            return(model);
        }
Пример #3
0
        // Note: The code below is not yet fully functional but working for just demo purposes.

        #region Generate Merged PDP pdf file


        public ActionResult MergedPDPView(StudentBookViewModel model)
        {
            return(View(model));
        }