public ActionResult SaveCandidatePrePlacementActivity(CandidatePrePlacementViewModel candidatePrePlacementViewModel) { var organisationId = UserOrganisationId; var centreId = UserCentreId; var personnelId = UserPersonnelId; try { candidatePrePlacementViewModel.CandidatePrePlacement.OrganisationId = organisationId; candidatePrePlacementViewModel.CandidatePrePlacement.CentreId = centreId; candidatePrePlacementViewModel.CandidatePrePlacement.CreatedBy = personnelId; int id = candidatePrePlacementViewModel.CandidatePrePlacement.CandidatePrePlacementId; if (id != 0) { var candidatePrePlacementData = _nidanBusinessService.RetrieveCandidatePrePlacement(organisationId, id); candidatePrePlacementViewModel.CandidatePrePlacement.PrePlacementActivityId = candidatePrePlacementData.PrePlacementActivityId; candidatePrePlacementViewModel.CandidatePrePlacement = _nidanBusinessService.UpdateCandidatePrePlacement(organisationId, candidatePrePlacementViewModel.CandidatePrePlacement); return(this.JsonNet(true)); } var batchPrePlacement = _nidanBusinessService.RetrieveBatchPrePlacement(organisationId, candidatePrePlacementViewModel.CandidatePrePlacement.BatchPrePlacementId); var admissionIds = _nidanBusinessService.RetrieveAdmissions(organisationId, e => e.BatchId == batchPrePlacement.BatchId).Items.Select(e => e.AdmissionId).ToList(); candidatePrePlacementViewModel.CandidatePrePlacement = _nidanBusinessService.CreateCandidatePrePlacement(organisationId, candidatePrePlacementViewModel.CandidatePrePlacement, admissionIds); return(this.JsonNet(true)); } catch (Exception e) { return(this.JsonNet(false)); } }