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

            batchViewModel.CourseInstallment.Name = "Test";
            batchViewModel.Course.Name            = "Test";
            ModelStateErrors(ModelState);
            if (ModelState.IsValid)
            {
                batchViewModel.Batch.OrganisationId = organisationId;
                batchViewModel.Batch.CentreId       = UserCentreId;
                batchViewModel.Batch = NidanBusinessService.CreateBatch(organisationId, batchViewModel.Batch, batchViewModel.BatchDay, batchViewModel.SelectedTrainerIds);
                return(RedirectToAction("Index"));
            }
            batchViewModel.Courses            = new SelectList(NidanBusinessService.RetrieveCourses(organisationId, e => true).ToList());
            batchViewModel.Trainers           = new SelectList(NidanBusinessService.RetrieveTrainers(organisationId, e => true).ToList());
            batchViewModel.Rooms              = new SelectList(NidanBusinessService.RetrieveRooms(organisationId, e => true).ToList());
            batchViewModel.CourseInstallments = new SelectList(NidanBusinessService.RetrieveCourseInstallments(organisationId, e => true).ToList());
            return(View(batchViewModel));
        }