public JobPostViewModel(JobPost entity) { var stackOverflow = "StackOverflow"; string sr = null; if (entity.RecruiterName == stackOverflow) sr = entity.SourceReference; if (!string.IsNullOrEmpty(entity.SourceReference) && entity.SourceReference.Contains("news.ycomb")) sr = "hn"; id = entity.Id; jobTitle = entity.JobTitle; jobType = entity.JobType; jobDescription = entity.JobDescription; jobLocation = entity.Location; jobCountry = entity.Country; hiringCompany = entity.HiringCompany; hiringCompanyWebsite = entity.HiringCompanyWebsite; hiringCompanyLogo = entity.HiringCompanyLogo; tagline = entity.Tagline; salaryMin = entity.SalaryMin; salaryMax = entity.SalaryMax; salaryType = entity.SalaryType; currency = entity.Currency; salaryNote = entity.SalaryNote; expiresOn = entity.ExpiresOn; dateCreated = entity.SourcePostedDate ?? entity.DateCreated; datePosted = entity.SourcePostedDate; sourceReference =sr; recruiterName = entity.RecruiterName == stackOverflow ? entity.RecruiterName : null; contactName = entity.ContactName; priority = string.IsNullOrEmpty(entity.Ip) ? (int?)null : 1; isHot = entity.IsHot; }
public JobPostViewModel(JobPost entity) { var stackOverflow = "StackOverflow"; string sr = null; const string hn = "hn"; if (entity.RecruiterName == stackOverflow) { sr = entity.SourceReference; } if (!string.IsNullOrEmpty(entity.SourceReference) && entity.SourceReference.Contains("news.ycomb")) { sr = hn; } id = entity.Id; jobTitle = entity.JobTitle; jobType = entity.JobType; jobDescription = entity.JobDescription; jobLocation = entity.Location; jobCountry = entity.Country; hiringCompany = entity.HiringCompany; hiringCompanyWebsite = entity.HiringCompanyWebsite; hiringCompanyLogo = entity.HiringCompanyLogo; tagline = entity.Tagline; salaryMin = entity.SalaryMin; salaryMax = entity.SalaryMax; salaryType = entity.SalaryType; currency = entity.Currency; salaryNote = entity.SalaryNote; expiresOn = entity.ExpiresOn; dateCreated = entity.SourcePostedDate ?? entity.DateCreated; datePosted = entity.SourcePostedDate; sourceReference = sr; if (sr == hn) { srUrl = entity.SourceReference; } recruiterName = entity.RecruiterName != stackOverflow ? entity.RecruiterName : null; contactName = entity.ContactName; priority = string.IsNullOrEmpty(entity.Ip) ? (int?)null : 1; isHot = entity.IsHot; }