Ejemplo n.º 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"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> SubjectsView([FromServices] IUserSubjectService subjectService)
        {
            var data = await subjectService.GetSubjectsAsync();

            return(View(data));
        }