Beispiel #1
0
        public ActionResult MonthOverview(int year, int month)
        {
            var redirector = CheckUserRights();

            if (redirector != null)
            {
                return(redirector);
            }

            var currUser = (UserModel)System.Web.HttpContext.Current.Session["user"];


            var thisMonthMarks = repository.Marks.Where(x => x.Date.Month == month &&
                                                        x.Date.Year == year &&
                                                        x.Student_PIN == currUser.Login).ToList();

            StudentMonthOverviewModel model = new StudentMonthOverviewModel()
            {
                StudentMarks = thisMonthMarks,
                Subjects     = repository.Disciplines.ToList(),
                Year         = year,
                Month        = month
            };

            return(View(model));
        }
Beispiel #2
0
        public ActionResult ViewStudentMarks(string id, int year, int month)
        {
            var redirector = CheckUserRights();

            if (redirector != null)
            {
                return(redirector);
            }

            var currUser = (UserModel)System.Web.HttpContext.Current.Session["user"];

            ViewBag.id = id;

            var curStudent = repository.Students.FirstOrDefault(x => x.PIN == id);

            if (curStudent == null)
            {
                return(View("ViewStudentFailed"));
            }

            var thisMonthMarks = repository.Marks.Where(x => x.Date.Month == month &&
                                                        x.Date.Year == year &&
                                                        x.Student_PIN == curStudent.PIN).ToList();

            StudentMonthOverviewModel model = new StudentMonthOverviewModel()
            {
                StudentMarks = thisMonthMarks,
                Subjects     = repository.Disciplines.ToList(),
                Month        = month,
                Year         = year
            };

            ViewBag.name = curStudent.FirstName + " " + curStudent.LastName;
            return(View(model));
        }