private List <string> GetNotEmptyLineList(Data.Job.JobDetailData detailData) { List <string> detailLineList = new List <string>(); if (!detailData.l1.Equals("")) { detailLineList.Add(detailData.l1); } if (!detailData.l2.Equals("")) { detailLineList.Add(detailData.l2); } if (!detailData.l3.Equals("")) { detailLineList.Add(detailData.l3); } if (!detailData.l4.Equals("")) { detailLineList.Add(detailData.l4); } if (!detailData.l5.Equals("")) { detailLineList.Add(detailData.l5); } if (!detailData.l6.Equals("")) { detailLineList.Add(detailData.l6); } return(detailLineList); }
// ================== Job Detail for candidate ========= public async Task <ActionResult> JobDetailCandidate(string job) { Data.Job.JobAllData selectedJob = await Data.Job.GetJobDetail(job); ViewData["SelectedJob"] = selectedJob; List <Data.Job.Category> categoryList = await Data.Job.GetCategoryList(); ViewData["CategoryList"] = categoryList; // =================== job detail ======================================== Data.Job.JobDetailData detail1 = JsonConvert.DeserializeObject <Data.Job.JobDetailData>(selectedJob.detail_1); Data.Job.JobDetailData detail2 = JsonConvert.DeserializeObject <Data.Job.JobDetailData>(selectedJob.detail_2); Data.Job.JobDetailData detail3 = JsonConvert.DeserializeObject <Data.Job.JobDetailData>(selectedJob.detail_3); Data.Job.JobDetailData detail4 = JsonConvert.DeserializeObject <Data.Job.JobDetailData>(selectedJob.detail_4); Data.Job.JobDetailData detail5 = JsonConvert.DeserializeObject <Data.Job.JobDetailData>(selectedJob.detail_5); Detail jobDetail1 = new Detail() { title = detail1.title, LineList = GetNotEmptyLineList(detail1) }; Detail jobDetail2 = new Detail() { title = detail2.title, LineList = GetNotEmptyLineList(detail2) }; Detail jobDetail3 = new Detail() { title = detail3.title, LineList = GetNotEmptyLineList(detail3) }; Detail jobDetail4 = new Detail() { title = detail4.title, LineList = GetNotEmptyLineList(detail4) }; Detail jobDetail5 = new Detail() { title = detail5.title, LineList = GetNotEmptyLineList(detail5) }; Console.WriteLine("detail 5 line list count = " + jobDetail5.LineList.Count); JobDetail jobDetailData = new JobDetail() { detailList = new List <Detail>() }; if (jobDetail1.LineList.Count != 0) { jobDetailData.detailList.Add(jobDetail1); } if (jobDetail2.LineList.Count != 0) { jobDetailData.detailList.Add(jobDetail2); } if (jobDetail3.LineList.Count != 0) { jobDetailData.detailList.Add(jobDetail3); } if (jobDetail4.LineList.Count != 0) { jobDetailData.detailList.Add(jobDetail4); } if (jobDetail5.LineList.Count != 0) { jobDetailData.detailList.Add(jobDetail5); } ViewData["JobDetailData"] = jobDetailData; return(View("job_detail_candidate")); }