コード例 #1
0
        public ActionResult GeneratePDF(int reportID)
        {
            StudentHomeworkServices hServicies = new StudentHomeworkServices();
            int id = Int32.Parse(Request.Cookies["UserSettings"].Values["UserId"]);

            List <StudentHomeworkViewModel> List = hServicies.GetStudentHomeWorks(id);

            switch (reportID)
            {
            case 1:
                //  information = "best";
                List <StudentHomeworkViewModel> bestHM = List.Where(a => a.StatusID == "Accepted").OrderByDescending(a => a.Grade).Take(10).ToList();
                return(new Rotativa.ViewAsPdf("_Homeworks", bestHM));

            case 2:
                //  information = "Uploaded";
                return(new Rotativa.ViewAsPdf("_Homeworks", List.Where(a => a.StatusID == "Uploaded")));

            case 3:
                //   information = "Pending";
                return(new Rotativa.ViewAsPdf("_Homeworks", List.Where(a => a.StatusID == "Pending")));

            case 4:
                //    information = "Accepted";
                return(new Rotativa.ViewAsPdf("_Homeworks", List.Where(a => a.StatusID == "Accepted")));

            case 5:
                //  information = "Rejected";
                return(new Rotativa.ViewAsPdf("_Homeworks", List.Where(a => a.StatusID == "Rejected")));

            default:
                /// information = "all";
                return(new Rotativa.ViewAsPdf("_Homeworks", List));
            }
        }
コード例 #2
0
        public ActionResult StudentHomeworks(int studentId)
        {
            StudentHomeworkServices         service = new StudentHomeworkServices();
            List <StudentHomeworkViewModel> list    = service.GetStudentHomeWorks(studentId);

            return(View(list));
        }