Example #1
0
        public virtual ActionResult ListMyGrade(int?TermId, int?page = 1)
        {
            string  userName = HttpContext.User.Identity.Name;
            Student stu      = _StudentService.GetByUserId(_UserService.GetUserByUserName(userName).Id);
            int     pageSize = 100;
            //#region Retrive Data
            int total;
            var articles = _ElectionService.GetDataTableForStudentScore(out total, "", TermId, page.Value,
                                                                        Order.Asscending, ScoreStateType.Score, ElectionOrderBy.Id, stu.Id, pageSize);
            var model = new ScoreListVM
            {
                TermId         = (TermId ?? 1),
                Order          = Order.Asscending,
                PageCount      = pageSize,
                PageNumber     = (page ?? 1),
                ScoreList      = articles,
                Term           = "",
                TotalElections = total
            };
            List <Term> kol = PopulateTermDropDownList(TermId);

            if (kol != null && kol.Count > 0 && TermId == null)
            {
                ViewBag.avglist = _ElectionService.ComputeStudentAvgForTerm(stu, kol[0].Id);
            }
            else if (kol != null && TermId != null)
            {
                ViewBag.avglist = _ElectionService.ComputeStudentAvgForTerm(stu, TermId.Value);
            }
            return(PartialView("_ListMyGrade", model));
        }