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 })); }
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)); }