// // GET: /OlympiadStudent/Delete/5 public ActionResult Delete(int?id) { OlympiadStudentDTO olympiadStudentDto = _olympiadStudentService.GetItem(id); var instructorDto = _instructorService.GetItem(olympiadStudentDto.InstructorID); ViewBag.ForInstructor = "Преподаватель"; ViewBag.Instructor = instructorDto.InstructorSurname + " " + instructorDto.InstructorName + " " + instructorDto.InstructorPatronymic; var studentDto = _studentService.GetItem(olympiadStudentDto.StudentID); ViewBag.Student = studentDto.StudentSurname + " " + studentDto.StudentName + " " + studentDto.StudentPatronymic; var olympiadDto = _olympiadService.GetItem(olympiadStudentDto.OlympiadID); ViewBag.Olympiad = olympiadDto.OlympiadName; var olympiadStudent = Mapper.Map <OlympiadStudentDTO, OlympiadStudentViewModel>(olympiadStudentDto); return(View(olympiadStudent)); }
// // GET: /OlympiadStudent/Edit/5 public ActionResult Edit(int id) { OlympiadStudentDTO olympiadStudentDto = _olympiadStudentService.GetItem(id); var olympiadStudent = Mapper.Map <OlympiadStudentDTO, OlympiadStudentViewModel>(olympiadStudentDto); var allOlympiads = _olympiadService.GetItems(); var itemsOlympiads = new List <SelectListItem>(); foreach (var st in allOlympiads) { itemsOlympiads.Add(new SelectListItem() { Text = st.OlympiadName, Value = st.OlympiadID.ToString() }); } ViewBag.Olympiads = itemsOlympiads; var allStudents = _studentService.GetItems(); var itemsStudents = new List <SelectListItem>(); foreach (var st in allStudents) { itemsStudents.Add(new SelectListItem() { Text = st.StudentSurname, Value = st.StudentID.ToString() }); } ViewBag.Students = itemsStudents; var allInstructors = _instructorService.GetItems(); var itemsInstructors = new List <SelectListItem>(); foreach (var st in allInstructors) { itemsInstructors.Add(new SelectListItem() { Text = st.InstructorSurname, Value = st.InstructorID.ToString() }); } ViewBag.Instructors = itemsInstructors; return(View(olympiadStudent)); }