예제 #1
0
        public async Task <IActionResult> AddMark(newMark NewMark)
        {
            NewMark.TheMark.Student = await _student.GetStudentByIdAsync(NewMark.TheMark.Student.Id);

            NewMark.TheMark.Subject = _manager.GetSubjectByName(NewMark.TheMark.Subject.SubjectName);
            _manager.AddMark(NewMark.TheMark);



            return(RedirectToAction("StudentDetail", new { id = NewMark.TheMark.Student.Id }));
        }
예제 #2
0
        public async Task <IActionResult> AddMark(int id)
        {
            var model = new newMark();


            model.student = await _student.GetStudentByIdAsync(id);

            var subjects = await _manager.GetAllSubjectsAsync();

            model.Subjects = subjects.Select(c => new SelectListItem
            {
                Value = c.SubjectName,
                Text  = c.SubjectName
            });


            return(View(model));
        }