public List <SearchJobListViewModel> AllJobsByCategory(int categoryId) { DataTable dt = _homeRepositories.AllJobsByCategory(categoryId); if (dt.Rows.Count > 0) { List <SearchJobListViewModel> lstfeautredJobs = new List <SearchJobListViewModel>(); for (int i = 0; i < dt.Rows.Count; i++) { string picpath = System.IO.Path.GetFullPath(hostingEnviroment.WebRootPath + dt.Rows[i]["CompanyLogo"]); if (!System.IO.File.Exists(picpath)) { string fName = $@"\ProfilePic\" + "Avatar_company.jpg"; dt.Rows[i]["CompanyLogo"] = fName; } 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"]), CTC = Convert.ToString(dt.Rows[i]["CTC"]), NumberOfDays = Convert.ToString(dt.Rows[i]["NumberOfDays"]), }; lstfeautredJobs.Add(feautredJob); } return(lstfeautredJobs); } throw new DataNotFound("Data not found"); }