public List <SearchJobListViewModel> ViewAllFeaturedJobs() { DataTable dt = _homeRepositories.ViewAllFeaturedJobs(); if (dt.Rows.Count > 0) { List <SearchJobListViewModel> lstfeautredJobs = new List <SearchJobListViewModel>(); for (int i = 0; i < dt.Rows.Count; i++) { SearchJobListViewModel feautredJob = new SearchJobListViewModel { JobPostId = Convert.ToInt32(dt.Rows[i]["JobPostId"]), CompanyLogo = Convert.ToString(dt.Rows[i]["CompanyLogo"]), JobTitle = Convert.ToString(dt.Rows[i]["JobTitle"]), EmploymentStatus = Convert.ToString(dt.Rows[i]["EmploymentStatus"]), City = Convert.ToString(dt.Rows[i]["City"]), HiringCriteria = Convert.ToString(dt.Rows[i]["HiringCriteria"]), CompanyName = Convert.ToString(dt.Rows[i]["CompanyName"]), JobTitleByEmployer = Convert.ToString(dt.Rows[i]["JobTitleByEmployer"]), FeaturedJobDisplayOrder = (dt.Rows[i]["FeaturedJobDisplayOrder"] as int?) ?? 0, }; lstfeautredJobs.Add(feautredJob); } return(lstfeautredJobs); } throw new DataNotFound("Data not found"); }