public ActionResult Download(int?id) { var organisationId = UserOrganisationId; var centreId = UserCentreId; bool isSuperAdmin = User.IsInAnyRoles("SuperAdmin"); var admission = !isSuperAdmin?NidanBusinessService.RetrieveAdmission(organisationId, centreId, id.Value) : NidanBusinessService.RetrieveAdmission(organisationId, id.Value, e => true); var data = NidanBusinessService.CreateEnrollmentBytes(organisationId, centreId, admission); return(File(data, ".pdf", string.Format("{0} {1} Enrollment.pdf", admission.Registration.Enquiry.FirstName, admission.Registration.Enquiry.LastName))); }
public ActionResult Download(int?id) { var organisationId = UserOrganisationId; var centreId = UserCentreId; var admission = new Admission(); var candidateFee = NidanBusinessService.RetrieveCandidateFee(organisationId, id.Value); var feeTypeId = candidateFee.FeeTypeId; string firstName = ""; string lastName = ""; Business.Enum.FeeType feeType = (Business.Enum.FeeType)feeTypeId; if (feeTypeId == 2) { var registration = NidanBusinessService.RetrieveRegistrations(organisationId, e => e.StudentCode == candidateFee.StudentCode).Items.FirstOrDefault(); var admissionData = NidanBusinessService.RetrieveAdmissions(organisationId, e => e.RegistrationId == registration.RegistrationId).Items.FirstOrDefault(); firstName = admissionData?.Registration.Enquiry.FirstName; lastName = admissionData?.Registration.Enquiry.LastName; admission = admissionData; } var data = feeTypeId == 1 || feeTypeId == 3 || feeTypeId == 4 || feeTypeId == 5 || feeTypeId == 6 ? NidanBusinessService.CreateRegistrationRecieptBytes(organisationId, centreId, id.Value) : NidanBusinessService.CreateEnrollmentBytes(organisationId, centreId, admission); return(File(data, ".pdf", string.Format("{0} {1} {2}.pdf", firstName, lastName, feeType.ToString()))); }