예제 #1
0
        public async Task <IActionResult> Grading([FromServices] IUserStudentService StudentService, [FromServices] IUserSubjectService SubjectService, string key, string info, int mark, int day, int month, int year, int gradingtype)
        {
            var Subject = await SubjectService.GetSubjectsAsync();

            var students = await StudentService.GetStudentsAsync();

            if (Subject.Count() != 0)
            {
                Subject
                .FirstOrDefault(o => o.Key == key)
                .Grades.ToList()
                .Add(new Grade()
                {
                    Info    = info,
                    grading = (GradingType)gradingtype,
                    Mark    = mark,
                    Time    = new DateTime(year, month, day)
                });
            }


            if (students.Count() != 0)
            {
                //var studentsdata = students.ToList();
                //studentsdata
                //    .FirstOrDefault(o => o.Key == key)
                //    .Grades.ToList()
                //    .Add(new Grade()
                //    {
                //        Info = info,
                //        grading = (GradingType)gradingtype,
                //        Mark = mark,
                //        Time = new DateTime(year, month, day)
                //    });
            }

            return(RedirectToAction("Grading"));
        }
예제 #2
0
        public async Task <IActionResult> StudentView([FromServices] IUserStudentService studentService)
        {
            var data = await studentService.GetStudentsAsync();

            return(View(data));
        }