// GET: Student public ActionResult StudentEntry() { StudentEntryVm studentEntryVm = new StudentEntryVm(); studentEntryVm.OrganizationSelectListItems = GetOrganizationListItem(); studentEntryVm.CourseSelectListItems = GetCourseListItem(); return(View(studentEntryVm)); }
public ActionResult StudentEntry(StudentEntryVm studentEntryVm) { HttpPostedFileBase file = Request.Files["Logo"]; studentEntryVm.Image = ConvertToBytes(file); studentEntryVm.OrganizationSelectListItems = GetOrganizationListItem(); studentEntryVm.CourseSelectListItems = GetCourseListItem(); var student = Mapper.Map <Student>(studentEntryVm); var organization = studentManager.GetOrganizationsById(studentEntryVm.OrganizationId); var course = studentManager.GetCoursesById(studentEntryVm.CourseId); student.Organizations = organization.ToList(); student.Courses = course.ToList(); bool isSaved = studentManager.SaveStudent(student); if (isSaved) { return(View(studentEntryVm)); } return(View(studentEntryVm)); }