コード例 #1
0
        public ActionResult Create(SubjectViewModel subjectViewModel)
        {
            var organisationId = UserOrganisationId;

            if (ModelState.IsValid)
            {
                subjectViewModel.Subject.OrganisationId = UserOrganisationId;
                subjectViewModel.Subject = NidanBusinessService.CreateSubject(UserOrganisationId, subjectViewModel.Subject, subjectViewModel.SelectedCourseIds, subjectViewModel.SelectedTrainerIds);
                return(RedirectToAction("Edit", new { id = subjectViewModel.Subject.SubjectId }));
            }
            subjectViewModel.Courses     = new SelectList(NidanBusinessService.RetrieveCourses(organisationId, e => true).ToList());
            subjectViewModel.Trainers    = new SelectList(NidanBusinessService.RetrieveTrainers(organisationId, e => true).ToList());
            subjectViewModel.CourseTypes = new SelectList(NidanBusinessService.RetrieveCourseTypes(organisationId, e => true).ToList());

            return(View(subjectViewModel));
        }