예제 #1
0
        // GET: BatchPrePlacement/Edit/{id}
        public ActionResult Edit(int?id)
        {
            var organisationId = UserOrganisationId;
            var centreId       = UserCentreId;

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //var centres = _nidanBusinessService.RetrieveCentres(organisationId, e => true);
            var batches                = _nidanBusinessService.RetrieveBatches(organisationId, e => e.CentreId == centreId);
            var batchPrePlacement      = _nidanBusinessService.RetrieveBatchPrePlacement(organisationId, id.Value);
            var candidatePrePlacements = _nidanBusinessService.RetrieveCandidatePrePlacements(organisationId, centreId, e => e.BatchPrePlacementId == id.Value).Items.Select(e => e.PrePlacementActivityId).ToList();
            var prePlacementActivities = _nidanBusinessService.RetrievePrePlacementActivities(organisationId, e => true);

            if (batchPrePlacement == null)
            {
                return(HttpNotFound());
            }
            var viewModel = new BatchPrePlacementViewModel
            {
                BatchPrePlacement = batchPrePlacement,
                //Centres = new SelectList(centres, "CentreId", "Name"),
                CentreId = batchPrePlacement.CentreId,
                Batches  = new SelectList(batches, "BatchId", "Name"),
                BatchId  = batchPrePlacement.BatchId,
                PrePlacementActivities = new SelectList(prePlacementActivities, "PrePlacementActivityId", "Name")
            };

            return(View(viewModel));
        }