public JobsearchExportViewModel Execute(ByJobSearchParams procParams)
        {
            // Get the job search
            var search = _jobsearchQuery.WithJobSearchId(procParams.JobSearchId).Execute();

            if (search == null)
            {
                throw new MJLEntityNotFoundException(typeof(JobSearch), procParams.JobSearchId);
            }

            // Form the workbook
            var workbook = new XLWorkbook();

            CreateSummaryWorksheet(workbook, search);
            CreateCompaniesWorksheet(workbook, search);
            CreateContactsWorksheet(workbook, search);
            CreateTaskWorksheet(workbook, search);
            CreatePositionWorksheet(workbook, search);

            // Save it to the memory string and return it
            var stream = new MemoryStream();

            workbook.SaveAs(stream);
            var result = new JobsearchExportViewModel
            {
                FileName           = "MyLeadsJobsExport.xlsx",
                ExportFileContents = stream.ToArray(),
                Mimetype           = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            };

            stream.Close();

            return(result);
        }
예제 #2
0
        public virtual ActionResult Edit(int id)
        {
            var jobSearch = _jobSearchByIdQuery.WithJobSearchId(id).Execute();

            return(View(jobSearch));
        }