public PartialViewResult JobReview(int?jid) { TempData["message"] = string.Empty; dynamic model = new ExpandoObject(); JobCategoryModel objCatMod = new JobCategoryModel(); var categoryList = objCatMod.GetList(); categoryList.ForEach(c => { // start by converting entire string to lower case var lowerCase = c.Category.ToLower(); // matches the first sentence of a string, as well as subsequent sentences var r = new Regex(@"(^[a-z])|\.\s+(.)", RegexOptions.ExplicitCapture); // MatchEvaluator delegate defines replacement of setence starts to uppercase c.Category = r.Replace(lowerCase, s => s.Value.ToUpper()); }); TempData["Category"] = categoryList; TempData["CancelJobReason"] = _ObjJobModel.GetJobCancelList(); JobModel _JobModel = new JobModel(); Job _Job = new Job(); _Job.JobCategoryId = 0; _Job.SortBy = "N"; List <Job> _JobList = MatchBxCommon.GenerateBadge(_JobModel.GetJobReview(_Job)); if (jid.GetValueOrDefault() != 0) { _JobList = _JobList.Where(x => x.JobId == jid.GetValueOrDefault()).ToList(); } foreach (Job _job in _JobList) { _JobList.ForEach(s => s.BudgetASPInt = Convert.ToInt32(s.BudgetASP)); _JobList.ForEach(s => s.EndsIn = (s.JobCompletionDate.Subtract(DateTime.Now)).Days + " days, " + (s.JobCompletionDate.Subtract(DateTime.Now)).Hours + " hours"); } var objJobListFiltered = _JobList.GroupBy(x => x.JobId).Select(y => y.First()).ToList(); ReviewRecord = objJobListFiltered.Count(); if (ReviewRecord > recordDisplay) { reviewloadmore = 1; } else { reviewloadmore = 0; } objJobListFiltered.ForEach(s => s.Isloadmore = reviewloadmore); if (_JobList.Count() == 0 && jid.GetValueOrDefault() != 0) { JobModel jobmodel = new JobModel(); Job obj = jobmodel.GetARecord(jid.GetValueOrDefault()); if (obj != null) { TempData["message"] = obj.JobStatus != "F" ? "This job is already approved" : "This job is already rejected"; } else { TempData["message"] = "This job does not exist"; } } model.JobReview = objJobListFiltered.OrderByDescending(x => x.JobId).Take(recordDisplay).ToList(); return(PartialView("JobReview", model.JobReview)); }